What is Docker client?
The Docker client ( docker ) is the primary way that many Docker users interact with Docker. When you use commands such as docker run , the client sends these commands to dockerd , which carries them out. The docker command uses the Docker API. The Docker client can communicate with more than one daemon.
How to configure docker client?
You can configure docker client using 2 ways.
- Environment variables
Location of config.json?
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 control certain aspects of how the docker command behaves.
To specify a different directory, use the DOCKER_CONFIG environment variable or the –config command line option. If both are specified, then the –config option overrides the DOCKER_CONFIG environment variable. The example below overrides the docker ps command using a config.json file located in the ~/testconfigs/ directory.
$ docker –config ~/testconfigs/ ps
Working with Docker Config Command
For easy reference, the following list of environment variables are supported by the
docker command line:
DOCKER_API_VERSIONThe API version to use (e.g.
DOCKER_CONFIGThe location of your client configuration files.
DOCKER_CERT_PATHThe location of your authentication keys.
DOCKER_CLI_EXPERIMENTALEnable experimental features for the cli (e.g.
DOCKER_DRIVERThe graph driver to use.
DOCKER_HOSTDaemon socket to connect to.
DOCKER_NOWARN_KERNEL_VERSIONPrevent warnings that your Linux kernel is unsuitable for Docker.
DOCKER_RAMDISKIf set this will disable ‘pivot_root’.
DOCKER_STACK_ORCHESTRATORConfigure the default orchestrator to use when using
docker stackmanagement commands.
DOCKER_TLSWhen set Docker uses TLS.
DOCKER_TLS_VERIFYWhen set Docker uses TLS and verifies the remote.
DOCKER_CONTENT_TRUSTWhen set Docker uses notary to sign and verify images. Equates to
--disable-content-trust=falsefor build, create, pull, push, run.
DOCKER_CONTENT_TRUST_SERVERThe URL of the Notary server to use. This defaults to the same URL as the registry.
DOCKER_HIDE_LEGACY_COMMANDSWhen set, Docker hides “legacy” top-level commands (such as
docker rm, and
docker pull) in
docker helpoutput, and only
Management commandsper object-type (e.g.,
docker container) are printed. This may become the default in a future release, at which point this environment-variable is removed.
DOCKER_TMPDIRLocation for temporary Docker files.
DOCKER_CONTEXTSpecify the context to use (overrides DOCKER_HOST env var and default context set with “docker context use”)
DOCKER_DEFAULT_PLATFORMSpecify the default platform for the commands that take the
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:
- Understanding Kubernetes’s Taints and Tolerations in easy way - July 5, 2020
- Understanding Node Selector and Node Affinity in Kubernetes - July 5, 2020
- Terrafrom – Example Code for remote-exec provisioner - July 5, 2020