π³Docker
What's Docker ?
Docker is a versatile and powerful platform that simplifies and streamlines the process of building, packaging, and deploying applications. It is based on containerization technology, which allows developers to package an application and all its dependencies into a single, self-contained unit called a container. These containers are highly portable and can run consistently across different environments, such as development, testing, and production, without any compatibility issues. Docker provides a standardized way to develop, ship, and run applications, making it an essential tool for modern software development. It offers benefits like isolation, scalability, and ease of deployment, making it a key component in the world of containerized applications.
Managing Docker
docker --version
Check Docker version
docker info
Display system-wide information about Docker
docker login
Log in to a Docker registry
docker logout
Log out from a Docker registry
docker system df
Show Docker disk usage
docker system prune
Remove all unused data (images, containers, etc.)
docker pull
Pull a Docker image from a registry
docker push
Push a Docker image to a registry
Managing Images
docker images
List locally available Docker images
docker rmi
Remove a Docker image
docker search
Search for a Docker image on Docker Hub
docker build -t
Build a Docker image from a Dockerfile
docker history
Show the history of an image
docker image prune
Remove all dangling images
docker image ls
List Docker images
Managing Containers
docker ps
List running containers
docker ps -a
List all containers, including stopped ones
docker create
Create a new container from an image
docker run
Create and start a new container from an image
docker run -d
Create and start a container in detached mode
docker stop
Stop a running container
docker start
Start a stopped container
docker restart
Restart a container
docker rm
Remove a container
docker exec -it
Execute a command in a running container
docker logs
View the logs of a container
docker stats
Display a live stream of container resource usage
docker attach
Attach to a running container's STDIN, STDOUT, and STDERR
Docker Containers
Managing Containers
docker top
Display the running processes of a container
docker inspect
View detailed information about a container
docker rename
Rename a container
docker update
Update the configuration of a container
docker diff
Inspect changes to files or directories in a container
docker wait
Block until a container stops, then print its exit code
docker export
Export a container's file system as a tar archive
docker cp :
Copy files/folders between a container and host
Container Networking
docker network ls
List Docker networks
docker network create
Create a Docker network
docker network inspect
View detailed information about a network
docker network connect
Connect a container to a network
docker network disconnect
Disconnect a container from a network
Container Health
docker container stats
Display a live stream of container resource usage
docker container stats
Display resource usage of a specific container
Docker Images
Managing Images
docker save
Save a Docker image to a tar archive file
docker load -i <image.tar>
Load a Docker image from a tar archive file
docker image prune
Remove all dangling images
docker image ls
List Docker images
docker image history
Show the history of an image
docker image build -t
Build a Docker image from a Dockerfile
Building Images
docker commit
Create a new image from a container
docker build -t
Build a Docker image from a Dockerfile
docker build -t - < Dockerfile
Build an image from a Dockerfile from stdin
Image Tagging and Publishing
docker tag
Create a tag for an image
docker push
Push an image to a registry
docker image inspect
View detailed information about an image
Docker Compose
Managing Compose
docker-compose up
Start services defined in a docker-compose.yml
docker-compose up -d
Start services in detached mode
docker-compose down
Stop and remove services defined in docker-compose.yml
docker-compose logs
View container logs for services in a compose file
docker-compose ps
List containers of services in a compose file
Docker Swarm
docker swarm init
Initialize a Docker Swarm mode
docker swarm join-token
Display the join token for adding nodes to a swarm
docker node ls
List nodes in a swarm
docker service ls
List services in a swarm
docker service create
Create a new service in a swarm
docker stack deploy
Deploy a new stack in a swarm

Last updated