List all containers
Running and stopped containers with their status and ports.
docker ps -aRun, inspect and clean up Docker containers and images, work with Docker Compose, and reclaim disk space safely.
15 commands
Running and stopped containers with their status and ports.
docker ps -aStarts a container in the background and maps a port to your machine.
docker run -d -p : --name Opens a shell in a fresh container that is deleted when you exit.
docker run -it --rm bashUse bash instead of sh if the image has it.
docker exec -it shLast 100 lines, then streams new ones.
docker logs -f --tail 100 Builds from the Dockerfile in the current folder.
docker build -t .Works the other way round too.
docker cp : Builds images if needed and starts all services in the background.
docker compose up -d --buildLeave out the service name to see all of them.
docker compose logs -f Stops and removes the containers and network. Add -v to also delete volumes (data).
docker compose downGracefully stops every running container.
docker stop $(docker ps -q)Space used by images, containers, volumes and build cache.
docker system dfDeletes untagged leftover layers from old builds. Asks before deleting.
docker image pruneDeletes all stopped containers. Asks before deleting.
docker container pruneRemoves stopped containers, unused networks, every image not used by a container, and the build cache.
docker system prune -aYou’ll need to re-download or rebuild images. Volumes are kept unless you add --volumes.
Every command copies as plain, clean text: no curly quotes, no long dashes, no invisible characters.