godz.online
Back to tools

TLDR reference

Docker commands

A searchable cheatsheet of everyday Docker tasks paired with the exact command. Type what you want to do, or filter by intent. Everything runs in your browser.

31 shown

How it works

A searchable cheatsheet for everyday Docker, organised around what you are trying to do rather than around the commands themselves. Type a goal - "view logs", "rebuild the stack", "reclaim space" - and the matching task surfaces with the exact command. The chips group tasks by intent: images, containers, logs and exec, Docker Compose, networks and volumes, and system cleanup.

Each card pairs the task with the precise command and a short note on the key flags, covering the daily loop of building images, running and inspecting containers, tailing logs, and bringing a Compose stack up and down. Everything is static and runs in your browser, so the lookup is instant and works offline once the page has loaded.

Example. Searching "logs" surfaces docker logs -f to stream a container's output, while filtering by the Compose chip lines up docker compose up -d, down, and up -d --build so you can start, stop, and rebuild a multi-service stack from one place.

FAQ

What is the difference between an image and a container?

An image is a read-only template: a snapshot of a filesystem plus the metadata needed to run it, built from a Dockerfile. A container is a running (or stopped) instance of an image, with its own writable layer on top. The relationship is like a class and an object: you build an image once and can start many containers from it. docker images lists the templates; docker ps lists the running instances.

What does Docker Compose add over plain docker run?

Compose describes a whole multi-container application in one docker-compose.yml file - services, their images, ports, volumes, networks, and environment - so you can start everything with a single docker compose up instead of a long, error-prone docker run for each piece. It also creates a shared network so the services can reach each other by name. For anything beyond a single throwaway container, Compose is the friendlier way to work.

How do I get a shell inside a running container?

Use docker exec -it <name> sh (or bash if the image has it). The -it flags attach an interactive terminal, and sh starts a shell inside the container so you can poke around its filesystem, check environment variables, or run one-off commands. This runs in the existing container; docker run by contrast starts a brand-new one, which is what you want for a fresh, disposable shell with --rm.

How do I free up the disk space Docker uses?

Docker accumulates stopped containers, unused images, build cache, and orphaned volumes over time. docker system df shows what is taking space, and docker system prune removes stopped containers, unused networks, and dangling images in one go; add -a to also remove images with no running container, and --volumes to include unused volumes. Run it periodically on a development machine, but read what it lists first so you do not delete data you still need.