Docker-Spickzettel
NEUDocker-Spickzettel mit Befehlen für Images, Container, run-Optionen, Logs, Volumes, Netzwerke, Builds, Dockerfile, Compose und Aufräumen. Mit Suche und Kopieren per Klick. Die Befehle sind auf Englisch.
Läuft zu 100 % in deinem Browser — deine Eingaben werden nie hochgeladen oder auf unseren Servern gespeichert.
95 Einträge in 12 Abschnitten
Images
docker imagesList local images.
docker pull <image>:<tag>Download an image from a registry.
docker rmi <image>Remove an image.
docker image ls --filter dangling=trueList untagged ("dangling") images.
docker tag <image> <repo>:<tag>Give an image another name or tag.
docker history <image>Show the layers an image is made of.
docker save -o image.tar <image>Export an image to a tar file.
docker load -i image.tarImport an image from a tar file.
Containers
docker psList running containers.
docker ps -aList all containers, including stopped ones.
docker start <container>Start a stopped container.
docker stop <container>Stop a container gracefully (SIGTERM, then SIGKILL after a timeout).
docker restart <container>Stop and start a container.
docker kill <container>Stop a container immediately.
docker rm <container>Remove a stopped container.
docker rm -f <container>Force-remove a container, even if running.
docker rename <old> <new>Rename a container.
docker statsLive CPU, memory and network use of containers.
Run & common flags
docker run <image>Create and start a container from an image.
docker run -d <image>Run in the background (detached).
docker run -it <image> shRun interactively with a terminal and open a shell.
docker run --rm <image>Remove the container automatically when it exits.
docker run --name web <image>Give the container a name.
docker run -p 8080:80 <image>Publish container port 80 on host port 8080.
docker run -e KEY=value <image>Set an environment variable.
docker run --env-file .env <image>Load environment variables from a file.
docker run -v mydata:/data <image>Mount a named volume into the container.
docker run --network mynet <image>Attach the container to a network.
docker run --restart unless-stopped <image>Restart automatically unless you stopped it yourself.
docker run -m 512m --cpus 1 <image>Limit memory and CPU.
Exec, logs & copy
docker exec -it <container> shOpen a shell inside a running container (use bash if the image has it).
docker exec <container> <command>Run one command in a running container.
docker logs <container>Show a container's logs.
docker logs -f --tail 100 <container>Follow the log, starting with the last 100 lines.
docker top <container>List processes inside a container.
docker cp <container>:/path/file .Copy a file from a container to the current folder.
docker cp ./file <container>:/path/Copy a local file into a container.
docker attach <container>Attach your terminal to the main process of a container.
Volumes
docker volume create <name>Create a named volume.
docker volume lsList volumes.
docker volume inspect <name>Show details of a volume, including where it is stored.
docker volume rm <name>Delete a volume and its data.
docker run -v "$(pwd)":/app <image>Bind-mount the current folder into the container (macOS, Linux, Git Bash).
docker run -v mydata:/data:ro <image>Mount a volume read-only.
Networks
docker network lsList networks.
docker network create <name>Create a user-defined bridge network (containers can reach each other by name).
docker network inspect <name>Show which containers are on a network and their IPs.
docker network connect <network> <container>Attach a running container to a network.
docker network disconnect <network> <container>Detach a container from a network.
docker port <container>Show published ports of a container.
Build
docker build -t myapp:1.0 .Build an image from the Dockerfile in this folder and tag it.
docker build -f Dockerfile.prod -t myapp .Build from a Dockerfile with another name.
docker build --no-cache -t myapp .Build without using the layer cache.
docker build --build-arg VERSION=1 -t myapp .Pass a build argument declared with ARG.
docker buildx build --platform linux/amd64,linux/arm64 -t myapp .Build for several CPU architectures with BuildKit.
Dockerfile instructions
FROM node:22-alpineBase image to start from.
WORKDIR /appSet the working directory for the next instructions.
COPY package*.json ./Copy files from the build context into the image.
RUN npm ciRun a command while building the image.
ENV NODE_ENV=productionSet an environment variable that stays in the image.
ARG VERSION=1Define a variable available only at build time.
EXPOSE 3000Document the port the app listens on (does not publish it).
USER nodeRun the following instructions and the container as this user.
ENTRYPOINT ["node"]The fixed program the container runs.
CMD ["server.js"]Default arguments or command, easy to override at run time.
FROM node:22 AS buildStart a named stage for a multi-stage build.
COPY --from=build /app/dist ./distCopy files from an earlier build stage.
Compose
Uses the "docker compose" plugin (older installs have docker-compose).
docker compose upCreate and start the services in docker-compose.yml.
docker compose up -d --buildRebuild images and start in the background.
docker compose downStop and remove containers and networks.
docker compose down -vSame, and also delete the named volumes.
docker compose psList the containers of the project.
docker compose logs -f <service>Follow the logs of a service.
docker compose exec <service> shOpen a shell in a running service.
docker compose pullPull the newest images for the services.
docker compose configValidate the file and print the final configuration.
Registry
docker loginLog in to Docker Hub.
docker login <registry-host>Log in to another registry.
docker push <repo>/<image>:<tag>Upload an image to a registry.
docker search <term>Search Docker Hub for images.
docker logoutRemove stored registry credentials.
Prune & cleanup
These delete data. Read the prompt before you confirm.
docker system dfShow disk space used by images, containers and volumes.
docker container pruneRemove all stopped containers.
docker image pruneRemove dangling images.
docker image prune -aRemove all images not used by a container.
docker volume pruneRemove volumes not used by any container.
docker network pruneRemove unused networks.
docker system pruneRemove stopped containers, unused networks, dangling images and build cache.
Inspect & formatting
docker inspect <container>Show the full JSON details of a container or image.
docker inspect -f '{{.State.Status}}' <container>Print one field using a Go template.
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container>Print the container IP address.
docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'Custom columns for docker ps.
docker ps -qPrint only container IDs, useful in scripts.
docker versionShow client and server versions.
docker infoShow system-wide information about the Docker daemon.
Schnelle Beispiele
Typische Eingaben und die Ergebnisse, die dieses Tool liefert.
Überblick
Docker verpackt eine Anwendung samt Abhängigkeiten in ein Image, das auf jedem Rechner gleich läuft. Dieser Docker-Spickzettel listet die Befehle, zu denen du am häufigsten greifst: Verwaltung von Images und Containern, run-Optionen, exec und Logs, Volumes, Netzwerke, Builds, Dockerfile-Anweisungen, Docker Compose, Registries und Aufräumen.
Befehle, die Daten löschen, etwa prune und compose down -v, tragen eine deutliche Warnung (auf Englisch). Ein letzter Abschnitt zeigt, wie du mit inspect und einem Go-Template-Formatstring ein einzelnes Feld ausliest. Die Beispiele nutzen die aktuelle Form des Plugins docker compose.
Befehle, Optionen und ihre Kurzbeschreibungen werden auf Englisch angezeigt, so wie du sie im Terminal siehst; übersetzt sind nur der Seitentext und die Oberfläche. Filtere die Liste, kopiere einen Befehl und ersetze Platzhalter wie <container>. Alles läuft in deinem Browser, nichts, was du eingibst, wird hochgeladen.
Warum dieses Tool?
- Den passenden docker-Befehl schnell finden
- run-Optionen einzeln erklärt
- Dockerfile-Anweisungen an einem Ort
- Aufräum-Befehle mit klaren Warnungen
- Jeden Befehl mit einem Klick kopieren
Funktionen
Images und Container
Pullen, auflisten, starten, stoppen, entfernen und umbenennen mit gängigen Optionen.
run-Optionen
-d, -it, --rm, -p, -e, -v, --network, --restart und Ressourcenlimits.
Dockerfile
FROM, COPY, RUN, ENV, EXPOSE, ENTRYPOINT, CMD und Multi-Stage-Syntax.
Compose
up, down, logs, exec, pull und config für Projekte mit mehreren Diensten.
Aufräumen
Speicherverbrauch prüfen und Container, Images, Volumes und Netzwerke bereinigen.
Inspect-Formate
Hole mit einem Go-Template einen einzelnen Wert aus docker inspect.
So funktioniert’s
Abschnitt wählen
Scrolle zu Containers, Volumes, Build oder dem Thema, das du brauchst (die Abschnittstitel sind auf Englisch).
Oder filtern
Gib ein Wort wie „logs“ oder „prune“ in das Feld „Diesen Spickzettel filtern“ ein.
Beschreibung prüfen
Lies, was jeder Befehl macht (die Beschreibung ist auf Englisch), besonders bei den Aufräum-Befehlen.
Kopieren und ausführen
Klicke auf Kopieren, füge es in dein Terminal ein und ersetze Platzhalter wie <image>.