Use the Docker command lineEstimated reading time: 15 minutes
To list available commands, either run docker with no parameters or
execute docker help:
$ docker Usage: docker [OPTIONS] COMMAND [ARG...] docker [ --help | -v | --version ] A self-sufficient runtime for containers. Options--config stringLocation of client config files (default "/root/.docker") -c, --context stringName of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use") -D, --debugEnable debug mode --helpPrint usage -H, --host valueDaemon socket(s) to connect to (default ) -l, --log-level stringSet the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info") --tlsUse TLS; implied by --tlsverify --tlscacert stringTrust certs signed only by this CA (default "/root/.docker/ca.pem") --tlscert stringPath to TLS certificate file (default "/root/.docker/cert.pem") --tlskey stringPath to TLS key file (default "/root/.docker/key.pem") --tlsverifyUse TLS and verify the remote -v, --versionPrint version information and quit CommandsattachAttach to a
running container # […]
Depending on your Docker system configuration, you may be required
to preface each docker command with sudo. To avoid having to use
sudo with the docker command, your system administrator can create
a Unix group called docker and add users to it.
For more information about installing Docker or sudo configuration,
refer to the installation instructions for your operating system.
For easy reference, the following list of environment variables are
supported by the docker command line:
- DOCKER_API_VERSION The API version to use (e.g. 1.19)
- DOCKER_CONFIG The location of your client configuration files.
- DOCKER_CERT_PATH The location of your authentication keys.
- DOCKER_CLI_EXPERIMENTAL Enable experimental features for the cli
(e.g. enabled or disabled)
- DOCKER_DRIVER The graph driver to use.
- DOCKER_HOST Daemon socket to connect to.
- DOCKER_NOWARN_KERNEL_VERSION Prevent warnings that your Linux
kernel is unsuitable for Docker.
- DOCKER_RAMDISK If set this will disable ‘pivot_root’.
- DOCKER_STACK_ORCHESTRATOR Configure the default orchestrator to use
when using docker stack management commands.
- DOCKER_TLS When set Docker uses TLS.
- DOCKER_TLS_VERIFY When set Docker uses TLS and verifies the remote.
- DOCKER_CONTENT_TRUST When set Docker uses notary to sign and verify
images. Equates to --disable-content-trust=false for build, create,
pull, push, run.
- DOCKER_CONTENT_TRUST_SERVER The URL of the Notary server to use.
This defaults to the same URL as the registry.
- DOCKER_HIDE_LEGACY_COMMANDS When set, Docker hides legacy”
top-level commands (such as docker rm, and docker pull) in docker
help output, and only Management commands per object-type (e.g.,
docker container) are printed. This may become the default in a
future release, at which point this environment-variable is
- DOCKER_TMPDIR Location for temporary Docker files.
- DOCKER_CONTEXT Specify the context to use (overrides DOCKER_HOST
env var and default context set with docker context use”)
- DOCKER_DEFAULT_PLATFORM Specify the default platform for the
commands that take the --platform flag.
Because Docker is developed using Go, you can also use any
environment variables used by the Go runtime. In particular, you
may find these useful:
These Go environment variables are case-insensitive. See the Go
specification for details on these variables.
By default, the Docker command line stores its configuration files
in a directory called .docker within your $HOME directory.
Docker manages most of the files in the configuration directory and
you should not modify them. However, you can modify the config.json file to contro