{"id":14109,"date":"2022-10-03T14:15:51","date_gmt":"2022-10-03T14:15:51","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=14109"},"modified":"2025-07-12T05:40:17","modified_gmt":"2025-07-12T05:40:17","slug":"how-to-configure-docker-client-with-a-configuration-file","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-configure-docker-client-with-a-configuration-file\/","title":{"rendered":"Docker Tutorials: Configure Docker client with a configuration file?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is Docker client?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to configure docker client?<\/h2>\n\n\n\n<p>You can configure docker client using 2 ways.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Environment variables<\/li><li>config.json<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Location of config.json?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>To specify a different directory, use the DOCKER_CONFIG environment variable or the &#8211;config command line option. If both are specified, then the &#8211;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.<\/p>\n\n\n\n<p>$ docker &#8211;config ~\/testconfigs\/ ps<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Working with Docker Config Command<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"189\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/05\/Docker-Config-Command.jpg\" alt=\"\" class=\"wp-image-14110\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/05\/Docker-Config-Command.jpg 758w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/05\/Docker-Config-Command-300x75.jpg 300w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/figure>\n\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/56d64ad7f9fe4572729ce8c936787325.js\"><\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"environment-variables\">Environment variables<\/h2>\n\n\n\n<p>For easy reference, the following list of environment variables are supported by the&nbsp;<code>docker<\/code>&nbsp;command line:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>DOCKER_API_VERSION<\/code>&nbsp;The API version to use (e.g.&nbsp;<code>1.19<\/code>)<\/li><li><code>DOCKER_CONFIG<\/code>&nbsp;The location of your client configuration files.<\/li><li><code>DOCKER_CERT_PATH<\/code>&nbsp;The location of your authentication keys.<\/li><li><code>DOCKER_CLI_EXPERIMENTAL<\/code>&nbsp;Enable experimental features for the cli (e.g.&nbsp;<code>enabled<\/code>&nbsp;or&nbsp;<code>disabled<\/code>)<\/li><li><code>DOCKER_DRIVER<\/code>&nbsp;The graph driver to use.<\/li><li><code>DOCKER_HOST<\/code>&nbsp;Daemon socket to connect to.<\/li><li><code>DOCKER_NOWARN_KERNEL_VERSION<\/code>&nbsp;Prevent warnings that your Linux kernel is unsuitable for Docker.<\/li><li><code>DOCKER_RAMDISK<\/code>&nbsp;If set this will disable \u2018pivot_root\u2019.<\/li><li><code>DOCKER_STACK_ORCHESTRATOR<\/code>&nbsp;Configure the default orchestrator to use when using&nbsp;<code>docker stack<\/code>&nbsp;management commands.<\/li><li><code>DOCKER_TLS<\/code>&nbsp;When set Docker uses TLS.<\/li><li><code>DOCKER_TLS_VERIFY<\/code>&nbsp;When set Docker uses TLS and verifies the remote.<\/li><li><code>DOCKER_CONTENT_TRUST<\/code>&nbsp;When set Docker uses notary to sign and verify images. Equates to&nbsp;<code>--disable-content-trust=false<\/code>&nbsp;for build, create, pull, push, run.<\/li><li><code>DOCKER_CONTENT_TRUST_SERVER<\/code>&nbsp;The URL of the Notary server to use. This defaults to the same URL as the registry.<\/li><li><code>DOCKER_HIDE_LEGACY_COMMANDS<\/code>&nbsp;When set, Docker hides \u201clegacy\u201d top-level commands (such as&nbsp;<code>docker rm<\/code>, and&nbsp;<code>docker pull<\/code>) in&nbsp;<code>docker help<\/code>&nbsp;output, and only&nbsp;<code>Management commands<\/code>&nbsp;per object-type (e.g.,&nbsp;<code>docker container<\/code>) are printed. This may become the default in a future release, at which point this environment-variable is removed.<\/li><li><code>DOCKER_TMPDIR<\/code>&nbsp;Location for temporary Docker files.<\/li><li><code>DOCKER_CONTEXT<\/code>&nbsp;Specify the context to use (overrides DOCKER_HOST env var and default context set with \u201cdocker context use\u201d)<\/li><li><code>DOCKER_DEFAULT_PLATFORM<\/code>&nbsp;Specify the default platform for the commands that take the&nbsp;<code>--platform<\/code>&nbsp;flag.<\/li><\/ul>\n\n\n\n<p>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:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>HTTP_PROXY<\/code><\/li><li><code>HTTPS_PROXY<\/code><\/li><li><code>NO_PROXY<\/code><\/li><\/ul>\n\n\n\n<p>Docker Tutorials Fundamental To Advanced-2021 Crash Course:- <a href=\"https:\/\/bit.ly\/3hOIbTB\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/bit.ly\/3hOIbTB<\/a><\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_11853\"><iframe loading=\"lazy\"  id=\"_ytid_25236\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_11853\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>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 ,&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862,1],"tags":[],"class_list":["post-14109","post","type-post","status-publish","format-standard","hentry","category-docker","category-sql"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=14109"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14109\/revisions"}],"predecessor-version":[{"id":31432,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14109\/revisions\/31432"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=14109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=14109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=14109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}