docker commands
46 commands, each with a one-line explanation. Click a command to copy it, or its title for details.
Commands 46 shown
-
docker buildx build --platform linux/amd64,linux/arm64 -t reg/img:tag --push .Cross-compile and push directly to registry with BuildKit
-
docker run --rm -it --env-file .env -p 8000:8000 img:tagLocal run with env vars from file; --rm auto-removes on exit
-
docker history --no-trunc img:tagSee each layer, its command, and size; identify bloat
-
docker system prune -af --volumesRemove stopped containers, unused images, networks, volumes
-
docker pull src-reg/img:tag && docker tag src-reg/img:tag dst-reg/img:tag && docker push dst-reg/img:tagRe-tag and push to another registry
-
docker save img:tag | gzip > img.tar.gzExport an image for air-gapped transfer
-
docker build --build-arg VERSION=1.2.3 --build-arg ENV=prod -t img:tag .Pass build-time variables into Dockerfile ARG instructions
-
trivy image --exit-code 1 --severity HIGH,CRITICAL img:tagFail pipeline if HIGH or CRITICAL CVEs found
-
docker sbom img:tagGenerate Software Bill of Materials for an image (Docker Desktop)
-
docker inspect <container> | jq '.[0].NetworkSettings.Networks'Drill into network settings of a running container
-
docker compose up -d --buildBuild and start all services in background
-
docker compose logs -f --tail=100 <service>Stream last 100 lines and follow a compose service
-
docker compose down -vStop and remove containers, networks, and volumes
-
docker system df -vDetailed breakdown of disk usage per image, container, volume
-
docker exec -it -u root <container> bashEnter container as root even if default user is non-root
-
docker cp ./local-file.conf <container>:/etc/app/config.confInject a file into a running container without rebuild
-
docker load < img.tar.gzImport an image exported with docker save
-
docker exec -it registry bin/registry garbage-collect /etc/docker/registry/config.ymlFree disk space in a self-hosted Docker Registry
-
docker build --target builder -t img:builder .Build only up to a specific stage in a multi-stage Dockerfile
-
docker build --build-arg APP_VERSION=1.2.3 --build-arg ENV=prod -t myapp:1.2.3 .Pass build-time variables to Dockerfile ARG instructions
-
docker buildx build --platform linux/amd64,linux/arm64 -t myapp:latest --push .Build and push multi-arch image using BuildKit
-
docker history --no-trunc <image>Show all layers with full commands and sizes
-
docker export <container> | tar -tvf - | head -30Inspect a container's merged filesystem as a tar stream
-
docker diff <container>Files added (A), changed (C), or deleted (D) in a running container
-
docker commit -m 'debug snapshot' <container> debug-snapshot:$(date +%s)Snapshot a running container's filesystem as an image
-
docker run --memory=512m --cpus=0.5 --oom-kill-disable=false myappLimit container to 512MB RAM and half a CPU core
-
docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}'One-shot CPU and memory snapshot for all containers
-
docker image prune -fRemove all <none>:<none> dangling images
-
docker system prune -a --volumes -fRemove stopped containers, unused images, networks, volumes
-
docker cp <container>:/app/config.yaml ./local-config.yamlExtract a single file from a running or stopped container
-
docker compose up -d --build --remove-orphansRebuild and start services, remove containers not in compose file
-
docker compose up -d --scale worker=5Run 5 replicas of the worker service
-
docker compose logs -f --tail=100 workerStream last 100 lines of a specific compose service
-
docker network inspect bridge | jq '.[0].Containers | to_entries[] | .value | {Name, IPv4Address}'Show IPs of all containers in the bridge network
-
docker network create --driver bridge --subnet 172.30.0.0/24 mynetCreate a bridge network with a custom subnet
-
docker save myapp:1.0 | gzip > myapp.tar.gz && docker load < myapp.tar.gzExport image to archive and reimport on another host
-
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD curl -sf http://localhost:8080/health || exit 1Native Docker healthcheck with curl (add to Dockerfile)
-
docker scout cves --only-fixed myapp:latestShow only CVEs that already have a fix available
-
docker run --rm -it --pid=host --network=host --privileged nicolaka/netshootFull-featured network debug container sharing host PID and network
-
docker buildx bake -f docker-bake.hcl --pushBuild/push multiple targets from one HCL file; parallel, DRY group definitions
-
docker buildx imagetools inspect <reg>/<name>:tag --format '{{json .Manifest}}'Show platforms in a manifest list without pulling layers; verify arm64+amd64
-
docker buildx create --name multi --use --driver docker-container --driver-opt network=hostCreate a BuildKit builder supporting multi-arch and cache export; default driver cannot
-
docker buildx build --secret id=token,src=token.txt -t <name> .Feed a secret to BuildKit; only RUN --mount=type=secret,id=token sees it, not history
-
docker context create remote --docker host=ssh://<host> && docker context use remoteRun docker against a remote daemon over SSH; no exposed TCP socket needed
-
docker run --read-only --tmpfs /tmp --security-opt no-new-privileges --cap-drop ALL <name>Immutable rootfs, writable /tmp only, block privilege escalation; container hardening
-
docker events --filter event=oom --filter type=containerStream live OOM events to catch memory-limited containers being killed
no commands match — try a different search