All Docker Commands in One Place…
- What is Docker?
Docker is a containerization platform that allows you to package and distribute applications in a lightweight and portable manner. One of the main benefits of Docker is that it allows you to run applications in a consistent environment, regardless of the underlying operating system or infrastructure.
- To use Docker, you will need to install the Docker engine on your machine. You can then use the docker command line tool to manage Docker containers. Here is a list of some common Docker commands that you may find useful:
Building Docker images
Build a Docker image from a Dockerfile.
Create a new Docker image from the changes made to a container.
docker build
docker commit
Running Docker containers
Run a new Docker container based on an image.
Start an existing stopped container.
Stop a running container.
Forcefully stop a running container.
Remove a stopped container.
docker run
docker start
docker stop
docker kill
docker rm
Inspecting Docker containers
List running containers.
View detailed information about a container.
docker ps
docker inspect
Building Docker images
Build a Docker image from a Dockerfile.
Create a new Docker image from the changes made to a container.
docker build
docker commit
Running Docker containers
Run a new Docker container based on an image.
Start an existing stopped container.
Stop a running container.
Forcefully stop a running container.
Remove a stopped container.
docker run
docker start
docker stop
docker kill
docker rm
Inspecting Docker containers
List running containers.
View detailed information about a container.
docker ps
docker inspect
Managing Docker images
List available Docker images.
Download a Docker image from a registry.
Upload a Docker image to a registry.
Remove a Docker image.
docker images
docker pull
docker push
docker rmi
Managing Docker volumes
Create a new Docker volume.
Remove a Docker volume.
List available Docker volumes.
docker volume create
docker volume rm
docker volume ls
Managing Docker networks
Create a new Docker network.
Remove a Docker network.
List available Docker networks.
docker network create
docker network rm
docker neywork ls
Running commands in a Docker container
Run a command in a running Docker container.
Copying files to and from a Docker container
Copy files to and from a Docker container.
docker exec
docker cp
Managing Docker services
Create a new Docker service.
Scale a Docker service.
Remove a Docker service.
List available Docker services.
docker service create
docker service scale
docker service rm
docker service ls
Managing Docker secrets
Create a new Docker secret.
Remove a Docker secret.
List available Docker secrets.
docker secret create
docker secret rm
docker secret ls
Managing Docker configs
Create a new Docker config.
Remove a Docker config.
List available Docker configs.
docker config create
docker config rm
docker config ls
Managing Docker nodes
List available Docker nodes.
View detailed information about a Docker node.
docket node ls
docker node inspect
Managing Docker tasks
List available Docker tasks.
View detailed information about a Docker task.
docker task ls
docker task inspect
Managing Docker plugins
Install a Docker plugin.
Enable a Docker plugin.
Disable a Docker plugin.
Remove a Docker plugin.
List available Docker plugins.
docker plugin install
docker plugin enable
docker plugin disable
docker plugin rm
docker plugin ls
Managing Docker swarm
Initialize a Docker swarm.
Join a Docker swarm as a worker or manager.
Leave a Docker swarm.
docker swarm init
docker swarm join
docker swarm leave
Logging
View the logs of a Docker container.
docker logs
Debugging
Show Docker disk usage.
Show Docker events.
Show Docker system information.
Remove unused data from Docker.
docker system df
docker system events
docker system info
docker system prune
Other Docker commands.
Log in to a Docker registry.
Log out of a Docker registry.
Show the Docker version information.
docker login
docker logout
docker version
Searching for Docker images
Search for Docker images in a registry.
docker search
Importing and exporting Docker images
Save a Docker image to a tar archive.
Load a Docker image from a tar archive.
docker save
docker load
Tagging Docker images
Tag a Docker image.
docker tag
Managing Docker stacks
Deploy a Docker stack.
List available Docker stacks.
List the tasks of a Docker stack.
Remove a Docker stack.
docker stack deploy
docker stack ls
docker stack ps
docker stack rm
Managing Docker system
Show Docker disk usage.
Show Docker events.
Show Docker system information.
Remove unused data from Docker.
docker system df
docker system events
docker system info
docker system prune
Debugging Docker
Display real-time performance statistics for a running container.
docker container stats
Other
Update the settings of a Docker plugin.
Set the current Docker context.
List available Docker contexts.
docker plugin set
docker context use
docker context ls
Managing Docker context
Create a new Docker context.
Remove a Docker context.
Managing Docker cluster
List available Docker clusters.
docker context create
docker context rm
docker cluster ls
Debugging Docker
Show Docker disk usage.
Show Docker events.
Show Docker system information.
Remove unused data from Docker.
docker system df
docker system events
docker system info
docker system prune
Other
Display the running processes of a container.
Update the configuration of a container.
docker top
docker update
Managing Docker secrets
Create a new Docker secret.
View detailed information about a Docker secret.
List available Docker secrets.
docker secret create
docker secret inspect
docker secret ls
Managing Docker configs
Create a new Docker config.
View detailed information about a Docker config.
List available Docker configs.
Managing Docker nodes
Promote a worker node to a manager in a Docker swarm.
Demote a manager node to a worker in a Docker swarm.
docker config create
docker config inspect
docker config ls
docker node promote
docker node demote
Managing Docker stacks
Deploy a Docker stack.
List available Docker stacks.
List the tasks of a Docker stack.
Remove a Docker stack.
docker stack deploy
docker stack ls
docker stack ps
docker stack rm
Managing Docker secrets
Create a new Docker secret.
View detailed information about a Docker secret.
Remove a Docker secret.
docker secret create
docker secret inspect
docker secret rm
Managing Docker configs
Create a new Docker config.
View detailed information about a Docker config.
Remove a Docker config.
Managing Docker nodes
List available Docker nodes.
View detailed information about a Docker node.
docker config create
docker config inspect
docker config rm
docker node ls
docker node inspect
Managing Docker tasks
List available Docker tasks.
View detailed information about a Docker task.
docker task ls
docker task inspect
Managing Docker plugins
Install a Docker plugin.
Enable a Docker plugin.
Disable a Docker plugin.
Remove a Docker plugin.
List available Docker plugins.
docker plugin install
docker plugin enable
docker plugin disable
docker plugin rm
docker plugin ls
Managing Docker images
Show the history of a Docker image.
docker image history
Managing Docker containers
Pause a running container.
Unpause a paused container.
List the port mappings or a specific mapping for a container.
docker container pause
docker container unpause
docker container port
Managing Docker networks
Connect a container to a network.
Create a new Docker network.
Disconnect a container from a network.
View detailed information about a Docker network.
List available Docker networks.
Remove a Docker network.
docker network connect
docker network create
docker network disconnect
docker network inspect
docker network ls
docker network rm
Debugging Docker
Show Docker disk usage.
Show Docker events.
Show Docker system information.
Remove unused data from Docker.
docker system df
docker system events
docker system info
docker system prune
I’m glad to have been able to help you!
Docker is a powerful tool that allows you to easily package and deploy applications in a consistent and portable manner. By using the various Docker commands, you can build and run Docker images, manage Docker containers, networks, and volumes, and perform a variety of other tasks.
I hope you have a better understanding of the various Docker commands and how they can be used.