Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Docker Tutorials: Configure Docker client with a configuration file?

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
  • config.json

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

Environment variables

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 removed.
  • 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:

  • HTTP_PROXY
  • HTTPS_PROXY
  • NO_PROXY

Docker Tutorials Fundamental To Advanced-2021 Crash Course:- https://bit.ly/3hOIbTB

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x