🐳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 --versionCheck Docker version
docker infoDisplay system-wide information about Docker
docker loginLog in to a Docker registry
docker logoutLog out from a Docker registry
docker system dfShow Docker disk usage
docker system pruneRemove 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 imagesList 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 pruneRemove all dangling images
docker image lsList Docker images
Managing Containers
docker psList running containers
docker ps -aList 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 statsDisplay 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 lsList 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 statsDisplay 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 pruneRemove all dangling images
docker image lsList 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 - < DockerfileBuild 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 upStart services defined in a docker-compose.yml
docker-compose up -dStart services in detached mode
docker-compose downStop and remove services defined in docker-compose.yml
docker-compose logsView container logs for services in a compose file
docker-compose psList containers of services in a compose file
Docker Swarm
docker swarm initInitialize a Docker Swarm mode
docker swarm join-tokenDisplay the join token for adding nodes to a swarm
docker node lsList nodes in a swarm
docker service lsList services in a swarm
docker service createCreate a new service in a swarm
docker stack deployDeploy a new stack in a swarm

Last updated