Running containers 37
| Command | What it does |
|---|---|
docker run | Run a new containerCreates a container from an image and starts it; a missing image is pulled first. |
docker run -it IMAGE sh | Open a shell in a new containerWorks when the image has sh on its PATH; -i keeps input open and -t gives it a terminal. |
docker run -it debian | Run interactivelyWith no command given, the image default starts, attached to a terminal you can type into. |
docker run -d IMAGE_NAME | Run in the backgroundDetached mode prints the ID of the new container and hands the prompt back. |
docker run -d -p 80:80 my_image nginx -g 'daemon off;' | Run a detached web serverA detached container stops when its root process returns, so the server is kept in the foreground. |
docker run --name test -d nginx:alpine | Run with a chosen nameLater commands can address the container as test; without --name the daemon invents a random one. |
docker run -d -p 8080:80 nginx | Publish a portRequests to port 8080 on the host are forwarded to port 80 inside the container. |
docker run -p 127.0.0.1:80:8080/tcp nginx:alpine | Publish on one host addressMaps container port 8080 to TCP port 80 on 127.0.0.1 only; with no address every interface is used. |
docker run -P nginx:alpine | Publish all exposed portsEach port the image marks as exposed gets a random free port on the host. |
docker run --expose 80 nginx:alpine | Expose a port without publishingMarks port 80 as exposed for -P and other containers; nothing is opened on the host. |
docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash | Set environment variablesThree ways at once: a name passed through from the shell, a name=value pair and a file of variables. |
docker run -e "deep=purple" -e today --rm alpine env | Pass a host variable throughA name with no value, here today, takes whatever that variable holds on the host. |
docker run --env-file env.list ubuntu env | grep -E 'VAR|USER' | Load variables from a fileLines are VARIABLE=value or a bare name read from the local environment; lines starting with # are skipped. |
docker run -v ./content:/content -w /content -i -t ubuntu pwd | Bind-mount a host folderMounts the content folder at /content and works from there; relative host paths need Engine 23 or newer. |
docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh | Mount with --mount syntaxSame job as -v written as key=value fields; the reference recommends this form. |
docker run -d -v hello:/world busybox ls /world | Mount a named volumeThe volume hello, created beforehand, appears inside the container at /world. |
docker run -w /path/to/dir/ ubuntu pwd | Set the working directoryThe command runs in that directory, which is created inside the container when it is missing. |
docker run --read-only -v /icanwrite busybox touch /icanwrite/here | Read-only root filesystemWriting then works only under the volumes you mount, here /icanwrite. |
docker run -d --tmpfs /run:rw,noexec,nosuid,size=65536k my_image | Mount an in-memory tmpfsThe text after the colon uses the same option names as the Linux tmpfs mount. |
docker run --rm -v /foo -v awesome:/bar busybox top | Remove the container on exitOn exit the container and its anonymous volume /foo are deleted; the named volume awesome survives. |
echo hello | docker run --rm -i busybox cat | Pipe input into a containerWith -i and no -t, standard input stays open so the container can sit in a shell pipeline. |
docker run -itd --network=my-net busybox | Run on a chosen networkOn a user-created bridge network, containers can reach each other by container name. |
docker run --restart=always redis | Restart automaticallyDocker starts the container again whenever it exits; the default policy is no. |
docker run --restart=on-failure:10 redis | Restart on failure, with a limitRestarts only after a non-zero exit status and gives up after ten failures in a row. |
docker run -d --name redis --restart unless-stopped redis | Restart unless stopped by handComes back after a crash or a daemon restart, but stays down once you stop it yourself. |
docker run -it -m 300M ubuntu:24.04 /bin/bash | Limit memoryCaps the processes in the container at 300M of memory. |
docker run -it --cpus=".5" ubuntu /bin/bash | Limit CPU timeOn a one-CPU host this holds the container to at most half of the CPU every second. |
docker run -it --rm --gpus all ubuntu nvidia-smi | Give access to NVIDIA GPUsNeeds the NVIDIA container runtime on the host; a device= value picks single GPUs instead of all. |
docker run -it --entrypoint /bin/bash example/redis | Override the entrypointStarts Bash in place of the binary the image is set up to launch. |
docker run --pull=never hello-world | Run without pullingFails with an error when the image is not in the local cache, where the default would download it. |
docker run --add-host=my-hostname=8.8.8.8 --rm -it alpine | Add a hosts-file entryWrites the name and its address into /etc/hosts inside the container. |
docker run -l my-label --label com.example.foo=bar ubuntu bash | Label a containerLabels are metadata that filters such as docker ps --filter label= can match. |
docker run -t -i --privileged ubuntu bash | Run with full privilegesTurns on all kernel capabilities and host device access; the reference says to use it with caution. |
docker create | Create without startingPrepares a container from an image and prints its ID; it stays in the created state until started. |
docker container create -i -t --name mycontainer alpine | Create an interactive containerSets up a terminal-ready container for later; nothing runs yet. |
docker container start --attach -i mycontainer | Start and attachTogether with the create line above, this equals one docker run -it. |
docker start | Start stopped containersTakes one or more names or IDs; -a attaches the output and -i the input. |
Listing containers and reading logs 29
| Command | What it does |
|---|---|
docker ps | List running containersOnly running containers appear by default, which is why an exited one seems to be missing. |
docker ps -a | List all containersAdds stopped and exited containers to the list. |
docker ps --no-trunc | Show untruncated outputPrints full container IDs and complete commands in place of the shortened columns. |
docker ps --size | Show disk use per containerAdds a SIZE column with two on-disk figures for each container; -s is the short flag. |
docker ps --filter status=running | Filter by statusOther values include created, restarting, paused, exited and dead. |
docker ps -a --filter 'exited=0' | Filter by exit codeFinds containers that finished successfully; any other code, such as 137, works the same way. |
docker ps --filter "name=nostalgic" | Filter by nameMatches every container whose name contains the given text. |
docker ps --filter ancestor=ubuntu | Filter by imageLists containers started from that image; with no tag written, latest is assumed. |
docker ps --filter "label=color=blue" | Filter by labelGive a label key alone to match any value, or key=value for an exact match. |
docker ps --format "{{.ID}}: {{.Command}}" | Print chosen fieldsA Go template replaces the table; start it with the word table to keep column headers. |
docker ps --format json | Output as JSON |
docker ps -q --filter ancestor=nginx:alpine | Print container IDs onlyThe quiet flag leaves just the IDs, ready to feed into another command. |
docker logs | Show container logsPrints what the container has logged up to now and returns. |
docker logs -f CONTAINER_NAME | Follow the logsKeeps the command attached and prints new STDOUT and STDERR lines as the container writes them. |
docker logs -n 5 0246aa4d1448 | Show the last linesPrints only the final five lines; the long flag is --tail. |
docker logs --timestamps | Prefix lines with timestampsEach entry starts with an RFC 3339 timestamp with nanoseconds. |
docker logs -f --until=2s test | Show logs up to a timeStops at entries older than two seconds; --since sets the opposite boundary. |
docker inspect | Inspect any objectReturns low-level details of containers, images, networks or volumes as a JSON array. |
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $INSTANCE_ID | Get a container IP addressA Go template pulls one value out of the JSON, here the address on each network. |
docker inspect --format='{{.LogPath}}' $INSTANCE_ID | Find the log file path |
docker inspect --type=volume myvolume | Inspect by object typeSettles which object is meant when a container and a volume share one name. |
docker inspect --size mycontainer | Include container sizeAdds SizeRootFs and SizeRw, the total size and the size of the writable layer. |
docker stats | Live resource usageStreams CPU, memory, network and block I/O figures for every running container. |
docker stats awesome_brattain 67b2525d8ad1 | Watch selected containersNames and IDs can be mixed; stopped containers return no data. |
docker stats nginx --no-stream --format "{{ json . }}" | One-off stats as JSONTakes a single sample and exits, so the result can go straight into a script. |
docker top | List processes in a containerAnything after the container name is handed to ps as options. |
docker port | Show port mappingsLists which host ports are bound to the ports of one container. |
docker port test 7890/tcp | Look up one port mappingAnswers with the host address bound to that container port and protocol. |
docker diff | List changed filesMarks each path A for added, D for deleted or C for changed since the container was created. |
Commands and files inside containers 17
| Command | What it does |
|---|---|
docker exec | Run a command in a containerNeeds a running container; the extra process ends when the main process does. |
docker exec -it mycontainer sh | Open a shell in a containerStarts a new interactive shell session next to the main process. |
docker exec -d mycontainer touch /tmp/execWorks | Run a command in the backgroundWith -d the command is started inside the container and the prompt comes straight back. |
docker exec -e VAR_A=1 -e VAR_B=2 mycontainer env | Run with extra variablesThe variables exist only for this one process, not for others in the container. |
docker exec -it -w /root mycontainer pwd | Run in another directoryWithout -w the command starts in the working directory set when the container was created. |
docker exec -it my_container sh -c "echo a && echo b" | Run chained commandsA chained or quoted command must go through a shell, because exec expects one executable. |
docker attach | Attach to a running containerConnects the terminal to the main process; Ctrl-p Ctrl-q detaches again if it was started with -i and -t. |
docker attach topdemo | Attach by nameShows what the main process prints from now on, which can look like a hang when it is silent. |
docker cp | Copy files to or from a containerOne side is CONTAINER:PATH, the other a local path; the container may be running or stopped. |
docker cp ./some_file CONTAINER:/work | Copy a file into a container |
docker cp CONTAINER:/var/logs/ /tmp/app_logs | Copy a folder out of a container |
docker cp CONTAINER:/var/logs/app.log - | tar x -O | grep "ERROR" | Stream a file to stdoutA dash as destination makes cp write a tar stream, which tar then unpacks to the pipe. |
docker export | Export a container filesystemWrites a tar archive of the filesystem to STDOUT; data in mounted volumes is left out. |
docker export --output="latest.tar" red_panda | Export to a tar fileSame result as redirecting the output with > latest.tar. |
docker commit | Save a container as an imageTurns the file changes and settings of a container into a new image; volume data is not included. |
docker commit c3f279d17e0a svendowideit/testimage:version3 | Commit with a repository tagThe container is paused while the image is written unless pausing is switched off. |
docker commit --change "ENV DEBUG=true" c3f279d17e0a svendowideit/testimage:version3 | Commit with a Dockerfile changeApplies a Dockerfile instruction such as ENV, CMD or EXPOSE to the image being created. |
Stopping and removing containers 18
| Command | What it does |
|---|---|
docker stop | Stop running containersSends SIGTERM first and SIGKILL after a grace period, 10 seconds by default on Linux. |
docker restart | Restart containersStops and starts each listed container; -t sets how long to wait before killing it. |
docker kill | Kill running containersSends SIGKILL to the main process at once, with no grace period. |
docker kill --signal=SIGHUP my_container | Send another signalThe signal can be a name with or without the SIG prefix, or its number. |
docker pause | Pause containersSuspends every process in the container; on Linux this uses the freezer cgroup, so the processes do not notice. |
docker unpause | Resume paused containersLets the suspended processes of the listed containers carry on. |
docker wait | Wait for containers to stopBlocks the shell until the container exits, then prints its exit code. |
docker rename | Rename a containerTakes the current name or ID first and the new name second. |
docker update | Change container limitsAdjusts CPU, memory and restart settings on existing containers; not supported for Windows containers. |
docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse | Update several containersSets a CPU weight and a memory limit on two containers in one call. |
docker update --restart unless-stopped redis | Change the restart policyWorks on a container that is already running, without recreating it. |
docker update --restart unless-stopped $(docker ps -q) | Set a policy on every containerThe inner command supplies the IDs of all running containers. |
docker rm | Remove containersDeletes stopped containers by name or ID; a running one needs --force. |
docker rm --force redis | Force-remove a running containerThe main process receives SIGKILL and the container is then deleted. |
docker rm --volumes redis | Remove with anonymous volumesVolumes that were given a name are kept; -v is the short flag. |
docker rm $(docker ps --filter status=exited -q) | Remove all exited containersThe inner ps prints the IDs of exited containers and rm deletes them; the syntax depends on the shell. |
docker ps --filter status=exited -q | xargs docker rm | Remove exited containers with xargs |
docker container prune --force --filter "until=5m" | Prune older stopped containersDeletes stopped containers created more than five minutes ago and skips the confirmation prompt. |
Container commands in long form 25
The long docker container forms and the short top-level commands run the same code: docker container ls, docker container list, docker container ps and docker ps are one command.
| Command | What it does |
|---|---|
docker container run | Run a new containerFull name of docker run; takes the image, then an optional command and its arguments. |
docker container create | Create without startingShares most options with run, which itself performs a create before starting. |
docker container start | Start stopped containersBrings existing containers back up with the configuration they were created with. |
docker container stop | Stop running containersThe first signal can be changed with -s, and the wait before the kill with -t. |
docker container restart | Restart containersAccepts the same -s signal and -t timeout flags as stop. |
docker container kill | Kill running containersWith -s a different signal is sent, which may leave the container running. |
docker container pause | Pause containersOn Windows only Hyper-V containers can be paused. |
docker container unpause | Resume paused containersReverses pause through the same freezer cgroup on Linux. |
docker container wait | Wait for containers to stopSeveral containers can be listed; one exit code is printed for each. |
docker container rm | Remove containersAlso spelled docker container remove; -f removes a running container and -v its anonymous volumes. |
docker container prune | Remove all stopped containersAsks for confirmation first, then reports the deleted IDs and the space reclaimed. |
docker container rename | Rename a containerThe container keeps its ID; only the name other commands refer to is replaced. |
docker container update | Change container limitsA container started with --rm cannot have its restart policy changed. |
docker container ls | List containersThree other spellings do the same job: container list, container ps and plain docker ps. |
docker container inspect | Inspect containersLike docker inspect but limited to containers; -s adds total file sizes. |
docker container logs | Show container logsTakes exactly one container; --since and --until narrow the time range. |
docker container stats | Live resource usageWith -a, stopped containers are listed too, and --no-stream prints a single reading. |
docker container top | List processes in a containerShows the processes running inside one container, seen from the host. |
docker container port | Show port mappingsAn optional port and protocol after the name narrows the answer to one mapping. |
docker container diff | List changed filesThe container can be named by full ID, short ID or name. |
docker container exec | Run a command in a containerFails with an error while the container is paused. |
docker container attach | Attach to a running containerSeveral terminals can attach to the same container at once; --no-stdin attaches output only. |
docker container cp | Copy files to or from a containerContainer paths are taken relative to its root directory, so the leading slash is optional. |
docker container export | Export a container filesystemThe -o flag writes the archive to a file without shell redirection. |
docker container commit | Save a container as an imageFlags -a and -m record an author and a commit message with the image. |
Pulling and listing images 18
| Command | What it does |
|---|---|
docker pull | Pull an imageFetches from Docker Hub unless the name starts with a registry host; with no tag written, latest is used. |
docker image pull debian:bookworm | Pull a specific tagLayers already stored for another tag of the repository are reused, so only the missing parts download. |
docker pull ubuntu@sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30 | Pull by digestA digest pins one exact image version, so later updates of the tag are not picked up. |
docker image pull myregistry.local:5000/testing/test-image | Pull from another registryRegistry host and port go in front of the repository path, with no https:// prefix. |
docker image pull --all-tags ubuntu | Pull every tag of a repositoryWithout the flag only one image is fetched, the one tagged latest. |
docker pull --platform=linux/riscv64 alpine:latest | Pull for another platformFetches the variant built for that OS and architecture instead of the one matching the host. |
docker images | List local imagesShows repository, tag, ID, age and size; intermediate layers and untagged images stay hidden unless -a is added. |
docker images java:8 | List by repository and tagThe name has to match exactly: docker images jav would not list the java image. |
docker images --no-trunc | Show full image IDsPrints the whole sha256 identifier where the table normally shows twelve characters. |
docker images --digests | Show image digestsAdds a DIGEST column with the content-addressable identifier that v2 registries assign. |
docker images --filter "dangling=true" | List dangling imagesShows untagged leftovers, typically what remains after a rebuild took over the repo:tag. |
docker images --filter "label=com.example.version" | Filter images by labelMatches any image carrying that label key; append =value to require a particular value. |
docker images --filter "before=image1" | Filter by creation orderKeeps images created earlier than image1; the since filter gives the later ones. |
docker images --filter=reference='busy*:*libc' | Filter by name patternWildcards work in both the repository part and the tag part of the pattern. |
docker images --format "{{.ID}}: {{.Repository}}" | Print chosen image fieldsA Go template replaces the table; other placeholders include .Tag, .Digest, .CreatedSince and .Size. |
docker image ls --tree | Show platform variants as a treeExperimental view that nests the per-platform entries under each multi-platform image. |
docker history | Show image layer historyOne line per layer, with the instruction that made it, its age and its size. |
docker history --format "{{.ID}}: {{.CreatedSince}}" busybox | Print chosen history fieldsPlaceholders such as .CreatedBy, .Size and .Comment select what each line contains. |
Tagging, saving and removing images 18
| Command | What it does |
|---|---|
docker tag | Tag an imageGives an existing image a further name; the source may be an ID, a name or a name with tag. |
docker tag httpd fedora/httpd:version1.0 | Tag by image nameNames the local httpd image version1.0 in the fedora repository. |
docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0 | Tag for a private registryThe registry host and port must be part of the name before the image can be pushed there. |
docker rmi | Remove imagesRemoving by tag only drops that tag while other tags still point at the image; registries are not touched. |
docker rmi -f fd484f19954f | Force-remove by image IDNeeded when one ID carries several tags: all of them are untagged and the image is deleted. |
docker rmi $(docker images -f "dangling=true" -q) | Remove dangling imagesThe inner command supplies the IDs of all untagged images. |
docker image prune -a | Remove every unused imageGoes beyond dangling images and also deletes tagged ones that no container refers to. |
docker image prune -a --force --filter "until=240h" | Prune images older than a cutoffSkips the confirmation and removes only unused images created more than 240 hours ago. |
docker image prune --filter="label=deprecated" | Prune images by labelLimits the cleanup to images carrying that label; label!= inverts the test. |
docker save | Save images to a tar fileWrites to STDOUT unless -o names a file; all parent layers and tags go into the archive. |
docker save -o fedora-latest.tar fedora:latest | Save one tag to a fileNaming repo:tag stores just that image; the bare repository name would store every tag. |
docker save myimage:latest | gzip > myimage_latest.tar.gz | Save as a gzip archiveThe tar stream on STDOUT is piped through gzip before it reaches the disk. |
docker load | Load images from a tar archiveReads STDIN unless -i names a file; images and their tags are restored, compressed archives included. |
docker load --input fedora.tar | Load from a file |
docker load < busybox.tar.gz | Load from standard inputShell redirection feeds the archive in; gzip, bzip2, xz and zstd files are unpacked on the fly. |
docker import | Import a tarball as an imageTurns a filesystem archive from a file, a URL or STDIN into a new image. |
docker import https://example.com/exampleimage.tgz | Import from a URLThe result is an untagged image; add a repository name as last argument to tag it. |
cat exampleimage.tgz | docker import - exampleimagelocal:new | Import from a pipeThe dash stands for STDIN, and the last argument tags the new image. |
Image commands in long form 12
| Command | What it does |
|---|---|
docker image ls | List local imagesAlso spelled docker image list or docker images; an optional repository name narrows the list. |
docker image pull | Pull an imageThe argument is a name with an optional tag or digest; -q hides the progress output. |
docker image push | Push an imageTakes one name with an optional tag; -a pushes all tags of the repository. |
docker image build | Build an imageOne of the spellings of docker build; -t names the result and -f picks the Dockerfile. |
docker image tag | Tag an imageSource comes first and the new name second; each may carry its own tag. |
docker image inspect | Inspect imagesPrints the stored configuration and metadata as JSON; -f extracts single values with a template. |
docker image history | Show image layer historyWith --no-trunc the full creating command of every layer is printed, and -q leaves only IDs. |
docker image save | Save images to a tar fileSeveral images can be listed; --platform limits the archive to chosen platform variants. |
docker image load | Load images from a tar archiveTakes no positional argument: the archive arrives on STDIN or through -i. |
docker image import | Import a tarball as an imageFlag -c applies Dockerfile instructions to the result and -m stores a commit message. |
docker image rm | Remove imagesAlso spelled docker image remove or docker rmi; an image used by a running container needs -f. |
docker image prune | Remove dangling imagesAsks before deleting; untagged images go by default, and -a widens that to all unused ones. |
Registry login, search and push 14
| Command | What it does |
|---|---|
docker login | Log in to a registryWith no server named it signs in to Docker Hub, by default through a device-code page in the browser. |
docker login registry.example.com | Log in to a self-hosted registryAdd a port after the host when the registry does not listen on 443 or 80. |
docker login -u moby | Log in with a usernameThe password or access token is then typed at an interactive prompt. |
cat ~/my_password.txt | docker login --username foo --password-stdin | Log in without a promptTaking the password from STDIN keeps it out of the shell history and log files. |
docker logout | Log out of a registryWhen no server is given, the default registry of the daemon is the one signed out of. |
docker logout localhost:8080 | Log out of one registry |
docker search | Search Docker HubLists matching repositories with their description, star count and an official marker. |
docker search --filter is-official=true --filter stars=3 busybox | Search official images onlyFilters add up: here only official images with at least three stars come back. |
docker search --filter=stars=3 --no-trunc busybox | Show full descriptionsStops the DESCRIPTION column from being cut short. |
docker search --format "{{.Name}}: {{.StarCount}}" nginx | Print chosen search fieldsThe template can also use .Description, .IsOfficial and the word table for column headers. |
docker push | Push an imageUploads to Docker Hub or the registry named in the image name; five layers are sent in parallel by default. |
docker image tag rhel-httpd:latest registry-host:5000/myadmin/rhel-httpd:latest | Tag before pushingThe new name carries the registry host, which decides where the push will go. |
docker image push registry-host:5000/myadmin/rhel-httpd:latest | Push to a self-hosted registry |
docker image push --all-tags registry-host:5000/myname/myimage | Push every tagSends all local tags of that repository in one command. |
Building images 21
docker build, docker image build and docker builder build are aliases of docker buildx build, so the same options apply to all four spellings.
| Command | What it does |
|---|---|
docker build | Build an imageAlias of docker buildx build; the last argument is the build context: a path, a URL or a dash. |
docker build -t IMAGE_NAME . | Build and tag from this folderThe dot makes the current directory the build context, where the Dockerfile is looked for. |
docker buildx build -t docker/fedora-jboss:latest -t docker/fedora-jboss:v2.1 . | Apply several tagsRepeat -t to give one build result more than one repository name or version. |
docker buildx build -f path/to/Dockerfile . | Use another DockerfileWithout -f, the file named Dockerfile at the root of the context is read. |
docker buildx build --build-arg HTTP_PROXY=http://10.20.30.2:1234 --build-arg FTP_PROXY=http://40.50.60.5:4567 . | Set build argumentsEach flag fills one ARG of the Dockerfile; unlike ENV, the values do not stay in the image. |
docker buildx build -t mybuildimage --target build-env . | Build up to one stageIn a multi-stage Dockerfile the named stage becomes the result and the ones after it are skipped. |
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 . | Build for several platformsThe default image store cannot load a multi-platform result, so push it or switch to the containerd store. |
docker buildx build --load --progress=plain . | Show plain build outputPrints the raw output of every step as plain text; --load puts the result into the local image list. |
--no-cache | Build without the cacheA docker build flag: every instruction runs again, ignoring layers cached by earlier builds. |
--pull | Always pull base imagesA docker build flag: the registry is asked for newer versions of each image the Dockerfile references. |
docker buildx build --no-cache-filter install . | Skip the cache for one stageOnly the stage called install is rebuilt from scratch; several names are separated by commas. |
docker buildx build -o outdir . | Export files instead of an imageThe local exporter writes the files of the build result into that folder on the client. |
docker buildx build -t TAG --annotation "foo=bar" --push . | Build, annotate and pushThe --push flag sends the result straight to the registry named in the tag. |
docker buildx build --secret id=aws,src=$HOME/.aws/credentials . | Pass a secret fileA RUN step reads it through a type=secret mount, which keeps credentials out of the image layers. |
docker buildx build --ssh default=$SSH_AUTH_SOCK . | Forward the SSH agentRUN steps with a type=ssh mount can then reach private repositories with your keys. |
docker buildx build --cache-from=type=registry,ref=user/app . | Reuse cache from a registryImports build cache that an earlier build exported to that registry reference. |
docker buildx build --cache-to=type=inline . | Embed cache metadata in the image |
docker buildx build -q --check https://github.com/docker/docs.git | Run build checks onlyEvaluates the checks for the Dockerfile, here in a Git repository, without executing the build. |
docker builder prune | Clear the build cacheFrees cache only; containers, networks and images stay, unlike with docker system prune. |
docker builder prune -a | Clear all unused build cacheWithout -a only dangling cache records are removed. |
docker init | Scaffold Docker files for a projectAsks a few questions, then writes a Dockerfile, compose.yaml, .dockerignore and README.Docker.md. |
Buildx builders and cache 31
| Command | What it does |
|---|---|
docker buildx build | Start a BuildKit buildThe long form behind docker build; docker buildx b is a further short spelling. |
docker buildx bake | Build targets from a fileRuns the targets defined in an HCL, JSON or Compose file, in parallel. |
docker buildx bake -f docker-bake.dev.hcl db webapp-release | Bake chosen targetsNames the definition file with -f, then lists just the targets to build. |
docker buildx bake -f docker-bake.hcl --print db | Preview a bake targetShows the resolved build options for the target as JSON and builds nothing. |
docker buildx bake --list=targets | List bake targetsReads the bake file and prints what can be built; --list=variables shows its variables. |
docker buildx bake --set *.platform=linux/arm64 | Override a target valueThe part before the first dot is a target pattern, so * applies the change to every target. |
docker buildx create | Create a builderMakes an isolated builder for a Docker context or endpoint; with no argument the current configuration is used. |
docker buildx create --use --name mybuild node-amd64 | Create and select a builderGives the builder a name and, through --use, makes it the current one straight away. |
docker buildx create --name eager_beaver --append mycontext2 | Add a node to a builderWith --append the named builder gains a node instead of being replaced. |
docker buildx ls | List buildersShows every builder with its nodes, driver, status and platforms; an asterisk marks the current one. |
docker buildx inspect | Inspect a builderReports on the current builder, or on the one whose name is given. |
docker buildx inspect --bootstrap | Boot and inspect a builderMakes sure the builder has started before its details are printed. |
docker buildx use | Switch the current builderLater build commands run on the named builder; a context name selects the default builder of that context. |
docker buildx stop | Stop a builderHalts the current or named builder, but the next buildx build may start it again. |
docker buildx rm | Remove buildersDeletes the current or named builder; trying it on the default builder does nothing. |
docker buildx rm --all-inactive | Remove inactive buildersAsks for confirmation first unless --force is added. |
docker buildx du | Show build cache disk usageLists build cache records with their size, last access time and whether they are reclaimable. |
docker buildx du --verbose | Show detailed cache recordsSame as --format=pretty: every record is printed as a block of fields. |
docker buildx prune | Remove build cacheEmpties the cache of the selected builder after a confirmation prompt. |
docker buildx prune --filter "until=24h" | Prune cache by last useKeeps the records used within the last 24 hours and removes the rest. |
docker buildx imagetools | Work with registry imagesSubcommand group for manifest lists: useful for checking multi-platform images and attestations. |
docker buildx imagetools inspect | Inspect an image in a registry |
docker buildx imagetools create | Combine images into a new one |
docker buildx history | Work with build recordsSubcommand group; its ls, inspect, logs and rm subcommands list, examine and delete past builds. |
docker buildx history ls | List build records |
docker buildx history logs | Print the log of a build |
docker buildx policy | Work with build policiesSubcommand group with eval, which evaluates a policy for a source, and test, which runs policy tests. |
docker buildx debug | Start the build debugger |
docker buildx dap | Start a DAP debugger |
docker buildx dial-stdio | Proxy stdio to a builderMeant for tools that talk to the builder through the BuildKit API, not for people. |
docker buildx version | Show the Buildx versionPrints the module path, the version number and the commit it was built from. |
Volumes 16
| Command | What it does |
|---|---|
docker volume create | Create a volumeDocker invents a random name when none is given; the local driver is the default. |
docker volume create my-vol | Create a named volume |
docker volume create the-doctor --label is-timelord=yes | Create a labelled volumeA label is metadata that volume ls and volume prune filters can select on. |
docker volume ls | List volumesLists every volume Docker knows with its driver; -q prints names only. |
docker volume ls -f dangling=true | List unused volumesDangling here means no container references the volume. |
docker volume ls -f name=rose | Filter volumes by nameMatches every volume whose name contains the given text. |
docker volume ls --filter label=is-timelord=yes | Filter volumes by labelUse the key alone to match any value, or key=value for one value. |
docker volume ls --format "{{.Name}}: {{.Driver}}" | Print chosen volume fieldsA Go template replaces the table; .Mountpoint, .Labels and .Scope are among the placeholders. |
docker volume inspect | Inspect volumesReturns a JSON array with driver, labels, mount point and scope for each volume named. |
docker volume inspect --format '{{ .Mountpoint }}' myvolume | Find where a volume is storedPrints only the host path the volume data lives under. |
docker volume rm | Remove volumesFails for a volume that a container still uses. |
docker volume prune | Remove unused volumesBy default only anonymous volumes that no container references are deleted. |
docker volume prune -a | Prune named volumes tooExtends the cleanup from anonymous volumes to every unused volume, so check for data you still need. |
docker volume prune --filter "label!=keep" | Prune volumes except labelled onesSpares any volume that carries the label keep. |
docker volume update | Update a cluster volumeApplies to Swarm cluster volumes only, for example to change their availability. |
docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata | Back up a volumeA throwaway container mounts the volumes of dbstore plus the current folder and writes a tar file there. |
Networks 19
| Command | What it does |
|---|---|
docker network create | Create a networkMakes a bridge network unless another driver is chosen with -d. |
docker network create -d bridge my-bridge-network | Create a bridge networkA bridge network is isolated to one Docker host; spanning several hosts takes an overlay network. |
docker network create --driver=bridge --subnet=192.168.0.0/16 br0 | Create a network with a subnetSets the address range yourself instead of letting the daemon pick a free one. |
docker network create --ipv6 --subnet 2001:db8:1234::/64 my-net | Create an IPv6 bridge network |
docker network ls | List networksShows ID, name, driver and scope of every network the daemon knows. |
docker network ls --filter driver=bridge | Filter networks by driverFinds the networks managed by one driver, here bridge. |
docker network ls --filter type=custom | List user-defined networksThe value builtin lists the predefined networks instead. |
docker network ls --no-trunc | Show full network IDs |
docker network inspect | Inspect networksPrints the details of each named network as JSON; -f pulls out single values with a template. |
docker network inspect bridge | Inspect the default bridgeShows which containers sit on the default network and the IP address each one received. |
docker network connect | Connect a containerTakes the network first and the container second; the container can then talk to others on it. |
docker network connect multi-host-network container1 | Attach a running containerWorks on a container that is already running. |
docker network connect --ip 10.10.36.122 multi-host-network container2 | Connect with a fixed IP addressAssigns that address to the interface the container gets on this network. |
docker network connect --alias db --alias mysql multi-host-network container2 | Connect with network aliasesOther containers on that network can then reach it under the extra names. |
docker network disconnect | Disconnect a containerThe container has to be running; -f forces the disconnect. |
docker network rm | Remove networksEvery container must be disconnected from the network before it can be deleted. |
docker network rm 3695c422697f my-network | Remove several networksIDs and names can be mixed; a failure on one does not stop the others. |
docker network prune | Remove unused networksDeletes the networks that no container references, after asking for confirmation. |
docker network prune --force --filter until=5m | Prune older unused networksNo prompt, and only networks created more than five minutes ago are affected. |
Compose project lifecycle 35
Without -f, Compose searches the working directory and then its parent directories for compose.yaml or docker-compose.yaml.
| Command | What it does |
|---|---|
docker compose | Run a Compose subcommandParent command of everything below; global options such as -f, -p and --profile go before the subcommand. |
docker compose up | Start a Compose projectBuilds, creates and starts the services, then stays attached to their combined output until interrupted. |
docker compose up -d | Start in the backgroundDetached mode gives the prompt back and leaves the containers running. |
docker compose up --build | Rebuild images, then startService images are built first instead of reusing the ones that already exist. |
docker compose up --force-recreate | Recreate all containersReplaces every container even when nothing in its configuration or image is different. |
docker compose up --watch | Start with file watchServices with watch rules are synced or rebuilt whenever their source files are saved. |
docker compose --dry-run up --build -d | Preview a command in dry runPrints each step Compose would take and leaves the stack untouched; read-only commands like ps do not support it. |
docker compose down | Stop and remove a projectRemoves the containers and networks that up made; volumes are kept. |
docker compose down -v | Remove a project with its volumesAlso deletes the named volumes declared in the Compose file, so their data is gone. |
docker compose down --remove-orphans | Remove orphan containers tooClears containers left over from services that the Compose file no longer defines. |
docker compose down --rmi local | Remove the service images tooThe value local spares images with a custom tag, while all deletes every image the services use. |
docker compose stop | Stop servicesContainers are halted but kept, so docker compose start can bring them back. |
docker compose stop phpmyadmin | Stop one serviceNaming a service limits the command to it and leaves the rest of the project running. |
docker compose start | Start existing servicesOnly starts containers that already exist; it never creates new ones. |
docker compose start --wait | Start and wait until healthyReturns once the services report running or healthy and implies detached mode. |
docker compose restart | Restart servicesEdits to the Compose file are not applied by a restart; that takes docker compose up. |
docker compose pause | Pause servicesFreezes the running containers of the services until unpause is called. |
docker compose unpause | Resume paused servicesLets containers that were frozen with pause continue. |
docker compose kill | Force-stop servicesSends SIGKILL to the running containers instead of waiting for a clean shutdown. |
docker compose kill -s SIGINT | Send another signal to services |
docker compose rm | Remove stopped service containersAsks first unless -f is given; -s stops running containers beforehand and -v drops their anonymous volumes. |
docker compose create | Create service containersPrepares the containers without starting them; --build builds the images first. |
docker compose build | Build service imagesRun it after changing a Dockerfile or build folder; images are tagged project-service by default. |
docker compose build --no-cache | Rebuild services without cacheEvery build step runs again instead of reusing cached layers. |
docker compose pull | Pull service imagesDownloads the images the services refer to but starts nothing. |
docker compose pull db | Pull the image of one service |
docker compose pull --ignore-buildable | Pull only prebuilt imagesSkips services that have a build section, whose images would be built locally anyway. |
docker compose push | Push service imagesUploads images you built locally to the registry and repository named in each image field. |
docker compose scale | Scale servicesTakes SERVICE=REPLICAS pairs; --no-deps keeps linked services from being started. |
docker compose wait | Wait for services to stopBlocks until the containers of the listed services exit; --down-project then takes the project down. |
docker compose watch | Watch files and update servicesDedicated watch command that keeps sync and rebuild events apart from the application logs. |
docker compose -f compose.yaml -f compose.admin.yaml run backup_db | Combine several Compose filesFiles are merged in the order given, later ones overriding and extending earlier ones. |
docker compose -f ~/sandbox/rails/compose.yaml pull db | Use a Compose file elsewhereLets you run the command from any directory instead of the project folder. |
docker compose -p my_project ps -a | Set the project nameOverrides the default name, which comes from the directory holding the Compose file. |
docker compose --profile debug up | Enable a profileAdds the services assigned to the debug profile to those that have no profile at all. |
Compose logs, shells and one-off commands 34
| Command | What it does |
|---|---|
docker compose ps | List project containersShows each container of the project with its service, current status and ports. |
docker compose ps --all | List stopped containers tooIncludes exited containers and the ones left behind by docker compose run. |
docker compose ps --status=running | Filter containers by statusOther accepted states include paused, restarting and exited. |
docker compose ps --format json | List containers as JSON |
docker compose logs | Show service logsPrints the output of all services, or only of those named; --no-log-prefix drops the name before each line. |
docker compose logs -f | Follow the logs of all servicesKeeps streaming new lines until you press Ctrl+C. |
docker compose logs -f web | Follow one service |
docker compose logs --since 42m | Show recent logs onlyAccepts a relative age like 42m or an absolute timestamp. |
docker compose logs --tail | Show the last log linesGive the number of lines wanted per container; the default is all. |
docker compose exec | Run a command in a serviceThe Compose counterpart of docker exec: needs a running service container and allocates a TTY by default. |
docker compose exec web sh | Open a shell in a serviceNo -it flags are needed, because exec is interactive with a terminal by default. |
docker compose exec redis redis-cli GET hits | Run one command in a serviceExecutes inside the redis container that is already up; no new container is started. |
docker compose run | Run a one-time commandStarts a new container for the service with your command in place of the configured one. |
docker compose run web bash | Shell in a fresh service containerService ports are not published for run containers, which avoids clashes with the running service. |
docker compose run --rm web python manage.py db upgrade | Run a task and clean upThe container is deleted when the command finishes, even if the service has a restart policy. |
docker compose run --no-deps web python manage.py shell | Run without linked servicesStops Compose from starting the services this one is linked to. |
docker compose run --service-ports web python manage.py shell | Run with service ports mappedPublishes the ports from the service definition, which run otherwise leaves closed. |
docker compose run -e DEBUG=1 web python console.py | Run with an environment variableThe value applies to this one run and takes priority over the .env file. |
docker compose top | List processes per servicePrints the processes running in each container of the project. |
docker compose stats | Live resource usage per serviceStreams usage figures for the project containers; --no-stream prints one reading and exits. |
docker compose events | Stream container eventsReports events for every container in the project as they happen. |
docker compose events --json | Stream events as JSONEach event becomes one JSON object on its own line. |
docker compose images | List images used by servicesCovers the images of containers that have been created; -q prints IDs only. |
docker compose volumes | List project volumesService names narrow the list, and -q prints volume names only. |
docker compose port | Show a service port mappingGive the private port to get the public one back; --protocol switches from tcp to udp. |
docker compose ls | List Compose projectsOnly running projects appear unless -a is added. |
docker compose ls -a | List stopped projects too |
docker compose config | Render the resolved Compose fileMerges all -f files, fills in variables and prints the result; the project need not be running. |
docker compose config --images | List the image names in a projectPrints one image name per line instead of the whole configuration. |
docker compose version | Show the Compose versionThe --short flag reduces the output to the bare version number. |
docker compose attach | Attach to a service containerConnects your terminal to the main process of one service; --index picks a replica. |
docker compose cp | Copy files to or from a serviceOne side is SERVICE:PATH and the other a local path or a dash; --index picks a replica. |
docker compose export | Export a service filesystemWrites a tar archive to STDOUT, or to the file given with -o. |
docker compose commit | Save a service container as an imageThe optional last argument names the repository and tag of the new image. |
Compose conversion, publishing and alpha commands 7
| Command | What it does |
|---|---|
docker compose convert | Render the canonical Compose modelKept as a migration aid from docker-compose; docker compose config is declared as its alias. |
docker compose bridge | Convert Compose files to another modelParent command of the bridge tools; the conversion itself is docker compose bridge convert. |
docker compose bridge convert | Generate Kubernetes manifestsWrites Kubernetes resources or Helm charts into the out directory unless -o names another. |
docker compose publish | Publish a Compose applicationPushes the Compose file to an OCI registry under the given repository and tag. |
docker compose alpha dry-run | Dry-run a command (experimental)The global --dry-run flag of docker compose covers the same need. |
docker compose alpha scale | Scale services (alpha) |
docker compose alpha watch | Watch files (alpha) |
System information and cleanup 13
docker system prune leaves volumes alone unless --volumes is added, and even then it only removes anonymous volumes.
| Command | What it does |
|---|---|
docker info | Show daemon and host detailsReports the kernel version, how many containers and images exist and other facts about the installation. |
docker system info | Show system informationLong form of docker info; -f formats the result with a template or as JSON. |
docker info --format '{{json .}}' | Print system info as JSON |
docker system df | Show Docker disk usageSummarises the space held by images, containers and local volumes, with the reclaimable share of each. |
docker system df -v | Show disk usage in detailBreaks the summary down to single images, containers and volumes. |
docker system events | Stream daemon eventsPrints container, image, volume and network events as they happen; docker events is the short alias. |
docker events --since '10m' | Show recent events firstStarts with the events of the last ten minutes; with no --since only new events appear. |
docker events --filter 'container=test' --filter 'event=stop' | Filter the event streamFilters on different keys must all match, here one container and one event type. |
docker system prune | Clean up unused objectsAfter a prompt, deletes stopped containers, unused networks, dangling images and unused build cache; volumes stay. |
docker system prune -a | Prune all unused images tooWidens the image cleanup from dangling ones to every image that is not in use. |
docker system prune --volumes | Prune anonymous volumes tooAdds anonymous volumes that no container uses to the cleanup; named volumes are kept. |
docker system prune -a --volumes | Prune everything unusedThe widest cleanup: all unused images plus anonymous volumes, on top of the default set. |
docker system prune --filter "until=24h" | Prune objects older than a dayOnly objects created more than 24 hours ago are removed. |
Contexts and remote daemons 14
| Command | What it does |
|---|---|
docker context create | Create a contextA context records how to reach one daemon, so the CLI can switch between engines. |
docker context create --docker host=unix:///var/run/docker.sock my-context | Create a context for an endpointThe --docker option sets the daemon address the new context will connect to. |
docker context create --from existing-context my-context | Copy an existing contextWithout --from the new context is based on the one currently in use. |
docker context ls | List contextsAn asterisk marks the context that is active right now. |
docker context show | Print the current contextThe answer reflects DOCKER_CONTEXT or the --context option when either is set. |
docker context use | Switch the default contextSaved in the CLI config file, so the change holds for every shell and session. |
docker context use default | Return to the default context |
docker --context my-context ps | Use a context for one commandAffects only this invocation and leaves the default context as it was. |
docker context inspect | Inspect contextsShows the endpoint and metadata of the named contexts; -f formats the output. |
docker context update | Update a contextChanges the description or the Docker endpoint of an existing context. |
docker context export | Export a contextWrites a file named after the context with the extension .dockercontext unless another name is given. |
docker context export my-context - | Export a context to stdout |
docker context import | Import a contextReads a file made by context export; a hyphen as filename takes it from stdin. |
docker context rm | Remove contextsSeveral names can be listed; a context that is in use needs -f. |
Versions, help and other tools 8
| Command | What it does |
|---|---|
docker version | Show client and server versionsLists the version of each Docker component, whereas docker --version prints only the CLI version. |
docker --version | Show the CLI versionA single line about the CLI itself, where docker version details every component. |
docker version --format '{{.Server.Version}}' | Get the server version onlyA template picks single values out of the version data, handy in scripts. |
docker run --help | Show help for a commandAny command followed by --help prints its usage line and options. |
docker -H ssh://[email protected] ps | Use a remote daemon over SSHThe -H flag points this one command at another daemon socket; tcp:// addresses work the same way. |
docker pass | Manage keychain secretsKeeps secrets in the OS keychain for injection into containers; its subcommands are set, get, ls, rm and run. |
docker pass set GH_TOKEN=123456789 | Store a secret in the keychainA container can then receive it through an se:// reference in an -e option. |
docker dhi | Manage Docker Hardened ImagesPlugin for browsing the hardened image catalog, mirroring images to an organisation and handling customizations. |
No row on this page matches that filter.
Notes
The daily loop is four commands
Most Docker days are docker run, docker ps, docker logs and docker exec. docker run creates and starts a container from an image; docker ps shows what's running and docker ps -a adds the stopped ones — which matters because a crashed container disappears from the plain list and beginners conclude it never started. docker logs -f CONTAINER_NAME follows output, and docker exec -it mycontainer sh drops you inside a running container (sh rather than bash, because minimal images often lack bash).
Compose is the default, and it's a space now
Since Compose v2 the command is docker compose — a space, not the old hyphenated docker-compose binary. docker compose up -d starts the stack detached, docker compose logs -f tails every service together, and docker compose down stops and removes containers and networks (volumes survive unless you run docker compose down -v). The pairing worth internalizing: edit a Dockerfile → docker compose build → docker compose up -d recreates only what changed.
Cleanup, with one warning label
Docker hoards: stopped containers, dangling images, and build cache accumulate for weeks until the disk fills. docker system prune clears stopped containers, unused networks, dangling images and unused build cache in one shot — but read its prompt before confirming, and know that docker system prune -a also removes every image that no container uses, which means long re-pulls later. Volumes are skipped unless you add --volumes, as in docker system prune -a --volumes, and even then only anonymous ones go. docker stats and docker volume ls answer the two questions that precede most cleanups: what's eating resources, and what data would I lose?
Questions
What is the difference between docker run and docker exec?
run creates a new container from an image and starts it; exec runs an extra process (usually a shell) inside a container that's already running.
Why doesn't docker ps show my container?
Plain ps lists running containers only. If it exited or crashed, docker ps -a shows it with its exit status, and docker logs <id> shows why.
Is it docker compose or docker-compose?
docker compose (space) is the current v2 syntax built into the CLI. The hyphenated docker-compose is the legacy v1 binary; commands are otherwise near-identical.
Does docker compose down delete my data?
It removes containers and networks but keeps named volumes. Add -v only when you deliberately want volumes gone too.
Is docker system prune safe?
It removes stopped containers, unused networks, dangling images and unused build cache — running containers are untouched, and volumes are left alone unless you add --volumes. The riskier variant is prune -a, which also deletes every image that no container uses.
How do I clean up Docker disk space?
Run docker system prune. After a confirmation prompt it removes stopped containers, networks that no container uses, dangling images and unused build cache. docker system prune -a also removes every image that has no container associated with it, so those images have to be pulled or built again later.
Volumes are kept unless you add --volumes, which prunes anonymous volumes as well. To see where the space went before deleting anything, run docker system df, which lists the space used by images, containers and local volumes and how much of it is reclaimable.
How do I open a shell inside a running Docker container?
Run docker exec -it mycontainer bash, replacing mycontainer with the container name or ID that docker ps shows. The -i flag keeps standard input open and -t allocates a terminal, which together give an interactive shell.
If the image has no bash, run docker exec -it mycontainer sh instead. The command works only on a running container; start a stopped one first with docker start. The shell opens in the container's default working directory; -w sets another one and -u runs it as a different user.
Sources and checks
- Docker Docs: docker CLI reference Base command, global options and the list of top-level commands
- Docker CLI reference: docker container run Usage line, options and examples
- Docker CLI reference: docker container ls Usage line, options and examples
- Docker CLI reference: docker buildx build Usage line, options and examples
- Docker CLI reference: docker compose Global Compose options, -f, -p and profile examples, subcommand list
- Docker CLI reference: docker compose up Usage line, options and examples
132 more source pages
- Docker Docs: Running containers docker run examples for shells, variables, memory limits and entrypoints
- Docker CLI Cheat Sheet (PDF) Basic build, logs and run command lines
- Docker Docs: Publishing and exposing ports Port publishing example
- Docker CLI reference: docker volume create Usage line, options and examples
- Docker Docs: Start containers automatically Restart policy examples
- Docker Docs: Resource constraints CPU limit example
- Docker CLI reference: docker container create Usage line, options and examples
- Docker CLI reference: docker container start Usage line, options and examples
- Docker CLI reference: docker container logs Usage line, options and examples
- Docker CLI reference: docker inspect Usage line, options and examples
- Docker CLI reference: docker container stats Usage line, options and examples
- Docker CLI reference: docker container top Usage line and description
- Docker CLI reference: docker container port Usage line, options and examples
- Docker CLI reference: docker container diff Usage line, options and examples
- Docker CLI reference: docker container exec Usage line, options and examples
- Docker CLI reference: docker container attach Usage line, options and examples
- Docker CLI reference: docker container cp Usage line, options and examples
- Docker CLI reference: docker container export Usage line, options and examples
- Docker CLI reference: docker container commit Usage line, options and examples
- Docker CLI reference: docker container stop Usage line, options and examples
- Docker CLI reference: docker container restart Usage line, options and examples
- Docker CLI reference: docker container kill Usage line, options and examples
- Docker CLI reference: docker container pause Usage line, options and examples
- Docker CLI reference: docker container unpause Usage line, options and examples
- Docker CLI reference: docker container wait Usage line, options and examples
- Docker CLI reference: docker container rename Usage line, options and examples
- Docker CLI reference: docker container update Usage line, options and examples
- Docker CLI reference: docker container rm Usage line, options and examples
- Docker CLI reference: docker container prune Usage line, options and examples
- Docker CLI reference: docker container inspect Usage line and options
- Docker CLI reference: docker image pull Usage line, options and examples
- Docker CLI reference: docker image save Usage line, options and examples
- Docker CLI reference: docker image ls Usage line, options and examples
- Docker CLI reference: docker image history Usage line, options and examples
- Docker CLI reference: docker image tag Usage line, options and examples
- Docker CLI reference: docker image rm Usage line, options and examples
- Docker CLI reference: docker image prune Usage line, options and examples
- Docker CLI reference: docker image load Usage line, options and examples
- Docker CLI reference: docker image import Usage line, options and examples
- Docker CLI reference: docker image push Usage line, options and examples
- Docker CLI reference: docker image build Usage line, options and examples
- Docker CLI reference: docker image inspect Usage line and options
- Docker CLI reference: docker login Usage line, options and examples
- Docker CLI reference: docker logout Usage line, options and examples
- Docker CLI reference: docker search Usage line, options and examples
- Docker CLI reference: docker system prune Usage line, options and examples
- Docker CLI reference: docker builder prune Usage line and options
- Docker CLI reference: docker init docker init and the compose up --build line it prints
- Docker CLI reference: docker buildx bake Usage line, options and examples
- Docker CLI reference: docker buildx create Usage line, options and examples
- Docker Docs: Multi-platform builds Builder creation example
- Docker CLI reference: docker buildx ls Usage line, options and examples
- Docker CLI reference: docker buildx inspect Usage line, options and examples
- Docker CLI reference: docker buildx use Usage line, options and examples
- Docker CLI reference: docker buildx stop Usage line, options and examples
- Docker CLI reference: docker buildx rm Usage line, options and examples
- Docker CLI reference: docker buildx du Usage line, options and examples
- Docker CLI reference: docker buildx prune Usage line, options and examples
- Docker CLI reference: docker buildx imagetools Usage line, options and examples
- Docker CLI reference: docker buildx history Description and subcommand list
- Docker CLI reference: docker buildx policy Description and subcommand list
- Docker CLI reference: docker buildx Subcommand list
- Docker CLI reference: docker buildx dial-stdio Usage line, options and examples
- Docker CLI reference: docker buildx version Usage line, options and examples
- Docker Docs: Volumes Volume creation and backup examples
- Docker CLI reference: docker volume ls Usage line, options and examples
- Docker CLI reference: docker volume inspect Usage line, options and examples
- Docker CLI reference: docker volume rm Usage line, options and examples
- Docker CLI reference: docker volume prune Usage line, options and examples
- Docker Docs: Prune unused Docker objects Prune examples with filters and --volumes
- Docker CLI reference: docker volume update Usage line and options
- Docker CLI reference: docker network create Usage line, options and examples
- Docker Docs: Bridge network driver Network create and inspect examples
- Docker CLI reference: docker network ls Usage line, options and examples
- Docker CLI reference: docker network inspect Usage line and options
- Docker CLI reference: docker network connect Usage line, options and examples
- Docker CLI reference: docker network disconnect Usage line, options and examples
- Docker CLI reference: docker network rm Usage line, options and examples
- Docker CLI reference: docker network prune Usage line, options and examples
- Docker Docs: Docker Compose Quickstart Compose examples: up -d, up --watch, logs -f, down -v, exec
- Docker CLI reference: docker compose down Usage line, options and examples
- Docker CLI reference: docker compose stop Usage line and options
- Docker Docs: Using profiles with Compose Profile and single-service examples
- Docker CLI reference: docker compose start Usage line and options
- Docker CLI reference: docker compose restart Usage line and options
- Docker CLI reference: docker compose pause Usage line and description
- Docker CLI reference: docker compose unpause Usage line and description
- Docker CLI reference: docker compose kill Usage line, options and examples
- Docker CLI reference: docker compose rm Usage line, options and examples
- Docker CLI reference: docker compose create Usage line and options
- Docker CLI reference: docker compose build Usage line and options
- Docker CLI reference: docker compose pull Usage line, options and examples
- Docker CLI reference: docker compose push Usage line and options
- Docker CLI reference: docker compose scale Usage line and options
- Docker CLI reference: docker compose wait Usage line and options
- Docker CLI reference: docker compose watch Usage line and options
- Docker CLI reference: docker compose ps Usage line, options and examples
- Docker CLI reference: docker compose logs Usage line and options
- Docker CLI reference: docker compose exec Usage line and options
- Docker CLI reference: docker compose run Usage line, options and examples
- Docker Docs: Set environment variables in Compose docker compose run -e example
- Docker CLI reference: docker compose top Usage line, options and examples
- Docker CLI reference: docker compose stats Usage line and options
- Docker CLI reference: docker compose events Usage line and options
- Docker CLI reference: docker compose images Usage line and options
- Docker CLI reference: docker compose volumes Usage line and options
- Docker CLI reference: docker compose port Usage line and options
- Docker CLI reference: docker compose ls Usage line and options
- Docker CLI reference: docker compose config Usage line and options
- Docker CLI reference: docker compose version Usage line and options
- Docker CLI reference: docker compose attach Usage line and options
- Docker CLI reference: docker compose cp Usage line and options
- Docker CLI reference: docker compose export Usage line and options
- Docker CLI reference: docker compose commit Usage line and options
- Docker CLI reference: docker compose convert Usage line and options
- Docker CLI reference: docker compose bridge Description and subcommand list
- Docker CLI reference: docker compose bridge convert Usage line and options
- Docker CLI reference: docker system info Usage line, options and examples
- Docker CLI reference: docker system df Usage line, options and examples
- Docker CLI reference: docker system events Usage line, options and examples
- Docker CLI reference: docker context create Usage line, options and examples
- Docker CLI reference: docker context ls Usage line, options and examples
- Docker CLI reference: docker context show Usage line, options and examples
- Docker CLI reference: docker context use Usage line, options and examples
- Docker CLI reference: docker context inspect Usage line, options and examples
- Docker CLI reference: docker context update Usage line, options and examples
- Docker CLI reference: docker context export Usage line, options and examples
- Docker CLI reference: docker context import Usage line and description
- Docker CLI reference: docker context rm Usage line and options
- Docker CLI reference: docker version Usage line, options and examples
- Docker CLI reference: docker pass Usage line, options and examples
- Docker CLI reference: docker dhi Description and subcommand list
Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.
Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.