Day 20 Task: Docker Cheat sheet

Day 20 Task: Docker Cheat sheet

Happy containerization! ๐Ÿšข๐Ÿณ

ยท

2 min read

๐Ÿ”ถ Docker container

docker version: To check the docker version

docker ps: The list of containers started

docker ps -a: A list of all containers started

docker login <repository>: Connects to a remote repository

docker pull <image-name>: Extracts the image from the repository

docker push <image-name>: Push the image to the remote repository

docker run: Create and start a new container

docker rm <container-id>: Remove container

docker kill or stop <container-id>: Stop container

docker exec: Execute a command inside a running container.

docker logs: View logs from a container

docker stats: Display a live stream of container resource usage

๐Ÿ”ถ Docker image

docker images: List available images

docker rmi <image>: Delete image

docker build -t <image-name>: Build an image from "dockerfile"

docker image prune: Remove all unused images

๐Ÿ”ถ Docker compose

docker-compose up: Start containers defined in a docker-compose.yml

docker-compose up -d: Start the container in detach mode

docker-compose down: Stop container defined in a docker-compose.yml

docker-compose build: Build docker images defined in docker-compose.yml

docker-compose stop: Stop container started by docker-compose up

docker-compose ps: List container defined in a docker-compose.yml

docker-compose logs: View all logs defined in a docker-compose.yml

๐Ÿ”ถ Docker Volume

docker volume ls: List of volume

docker volume create: Create a volume

docker volume inspect: Display volume details

docker volume rm: Remove a volume

docker volume prune: Remove unused volume

๐Ÿ”ถDocker Network

docker network ls: List of networks

docker network create: Create a network

docker network inspect: Display network details

docker network rm: Remove a network

docker network prune: Remove unused network

In conclusion, a Docker cheat sheet serves as an invaluable resource for both beginners and experienced users of Docker. It condenses essential commands, concepts, and best practices into a concise and easily accessible format, streamlining the process of working with containers.

If you find my blog valuable, I invite you to like, share, and join the discussion. Your feedback is immensely cherished as it fuels continuous improvement. Let's embark on this transformative DevOps adventure together! ๐Ÿš€ #devops #90daysofdevop #git&github #docker

ย