DKR
Docker Cheatsheet
The docker and docker compose commands used daily for building, running, and managing containers.
Images
docker build -t name .Build an image from a Dockerfile
docker imagesList local images
docker rmi <image>Remove an image
docker pull <image>Download an image from a registry
Containers
docker run -p 3000:3000 imageRun a container, mapping a port
docker run -d imageRun a container in the background
docker psList running containers
docker ps -aList all containers, including stopped
docker stop <id>Stop a running container
docker exec -it <id> bashOpen a shell inside a running container
docker logs <id>View a container's logs
Docker Compose
docker compose upStart all services
docker compose up -dStart all services in the background
docker compose downStop and remove containers/networks
docker compose logs -fFollow logs from all services