0% found this document useful (0 votes)
13 views2 pages

Docker Cheat Sheet

Uploaded by

Saswata Mondal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Docker Cheat Sheet

Uploaded by

Saswata Mondal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Docker Basic Commands Cheat Sheet

Category Command Description

Version & Info docker --version Show Docker version

docker info Display system-wide information

Images docker pull <image> Download an image from Docker Hub

docker images List images

docker rmi <image_id> Remove an image

docker build -t <name>:<tag> . Build an image from Dockerfile

Containers docker run <image> Run a container

docker run -it <image> /bin/bash Run with interactive shell

docker run -d --name <name> <image> Run in background with name

docker ps List running containers

docker ps -a List all containers

docker stop <id> Stop container

docker start <id> Start stopped container

docker restart <id> Restart container

docker rm <id> Remove container

Logs & Access docker logs <id> View container logs

docker exec -it <id> bash Access running container shell

docker attach <id> Attach to container console

Volumes docker volume create <name> Create a volume

docker volume ls List volumes

docker volume inspect <name> View volume details

docker volume rm <name> Remove a volume

Networks docker network ls List networks

docker network create <name> Create a network

docker network connect <net> <container> Connect container to network

docker network inspect <net> View network details

Cleanup docker system prune Remove unused data

docker system prune -a Remove unused data + unused images

Docker Compose docker-compose up Start services

docker-compose up -d Start in background

docker-compose down Stop and remove services


docker-compose logs View logs

docker-compose build Build services

You might also like