Docker Cheatsheet

The most used docker commands, ready to copy and paste.

Fill in your values

Enter your own values below and every matching command updates automatically.

Build an image from the current directory

docker build -t <Image Name> .

List local images

docker images

Run a container in the background

docker run -d --name <Container Name> <Image Name>

List running containers

docker ps

List all containers, including stopped ones

docker ps -a

Stop a running container

docker stop <Container Name>

Start a stopped container

docker start <Container Name>

Remove a container

docker rm <Container Name>

Remove an image

docker rmi <Image Name>

Follow a container's logs

docker logs -f <Container Name>

Open a shell inside a running container

docker exec -it <Container Name> /bin/bash

Pull an image from a registry

docker pull <Image Name>

Push an image to a registry

docker push <Image Name>

Remove unused containers, images, and networks

docker system prune -f

Start services defined in docker-compose.yml

docker compose up -d

Stop services defined in docker-compose.yml

docker compose down

Follow logs for docker compose services

docker compose logs -f

No commands match your search.