Search Tutorials


Docker Commands - Docker Commands Cheat Sheet | JavaInUse

Docker Commands - Docker Commands Cheat Sheet

Docker Tutorial - Table Of Contents

Docker Deploying Spring Based WAR Application to Docker Deploying Spring Based JAR Application to Docker Deploying Multiple Spring Boot Microservices using Docker Networking Deploying Multiple Spring Boot Microservices using Docker Compose Deploying Spring Boot + MYSQL Application to Docker Publishing Docker Image to DockerHub Deploy Docker Swarm services using Play With Docker Deploy Docker Swarm services using Docker Stack Deploy Docker Swarm services to multiple AWS EC2 instances Docker Cheat Sheet
Docker Command Functionality
systemctl start docker Start Docker
docker image build -t employee-producer . Build Docker Image name with tag as employee-producer
docker container run -d employee-producer Run the image named employee-producer as a container in detached mode
docker container run -it employee-producer Run the image named employee-producer as a container in interactive mode
docker container run --name producer -d employee-producer Using the image employee-producer runs a container with name producer
docker container logs producer Show the logs of the container having the first two characters of its id as lb
docker container run -p 8080:8080 -d employee-producer Run the image named employee-producer as a container in detached mode and also link the internal docker port 8080 to external docker port 8080
docker container exec -it producer /bin/sh The docker exec command runs a new command in a running container. So here in the running docker container we are running the command /bin/sh
docker container stop producer Stop the container having the name as producer
docker container ps List the currently running containers
docker container rm lb Remove container having container id beginning with container id lb
docker network ls List all Docker Networks
docker network create network <name> Create a new Docker Network
docker volume ls List all Docker Volumes
docker volume <volume name> Remove Docker Volume
docker volume prune Remove all Docker Volumes not being used by the containers
docker volume inspect <volume name> Get details of a particular Docker Volume
docker-compose up Start the docker services using the default docker compose file
docker-compose up stop the docker services mentioned in the default docker compose file
docker swarm init Initialize a docker swarm
docker network create --driver overlay <driver name> Create a Driver of type overlay
docker service ls List all services in a docker swarm