Add support for DOCKER_CONFIG/--config to specific config file dir

Carry #11675

Aside from what #11675 says, to me a key usecase for this is to support
more than one Docker cli running at the same time but each may have its
own set of config files.

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2015-04-28 08:00:18 -07:00 committed by Tibor Vass
parent 5c0cf9dbf7
commit 408d7deaf7
3 changed files with 21 additions and 5 deletions

View File

@ -10,7 +10,7 @@ parent = "smn_cli"
# Using the command line # Using the command line
> **Note:** if you are using a remote Docker daemon, such as Boot2Docker, > **Note:** If you are using a remote Docker daemon, such as Boot2Docker,
> then _do not_ type the `sudo` before the `docker` commands shown in the > then _do not_ type the `sudo` before the `docker` commands shown in the
> documentation's examples. > documentation's examples.
@ -38,6 +38,7 @@ the [installation](/installation) instructions for your operating system.
For easy reference, the following list of environment variables are supported For easy reference, the following list of environment variables are supported
by the `docker` command line: by the `docker` command line:
* `DOCKER_CONFIG` The location of your client configuration files.
* `DOCKER_CERT_PATH` The location of your authentication keys. * `DOCKER_CERT_PATH` The location of your authentication keys.
* `DOCKER_DRIVER` The graph driver to use. * `DOCKER_DRIVER` The graph driver to use.
* `DOCKER_HOST` Daemon socket to connect to. * `DOCKER_HOST` Daemon socket to connect to.
@ -60,10 +61,21 @@ variables.
## Configuration files ## Configuration files
The Docker command line stores its configuration files in a directory called By default, the Docker command line stores its configuration files in a
`.docker` within your `HOME` directory. Docker manages most of the files in directory called `.docker` within your `HOME` directory. However, you can
`.docker` and you should not modify them. However, you *can modify* the specify a different location via the `DOCKER_CONFIG` environment variable
`.docker/config.json` file to control certain aspects of how the `docker` or the `--config` command line option. If both are specified, then the
`--config` option overrides the `DOCKER_CONFIG` environment variable.
For example:
docker --config ~/testconfigs/ ps
Instructs Docker to use the configuration files in your `~/testconfigs/`
directory when running the `ps` command.
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. command behaves.
Currently, you can modify the `docker` command behavior using environment Currently, you can modify the `docker` command behavior using environment

View File

@ -18,6 +18,7 @@ parent = "smn_cli"
--api-cors-header="" Set CORS headers in the remote API --api-cors-header="" Set CORS headers in the remote API
-b, --bridge="" Attach containers to a network bridge -b, --bridge="" Attach containers to a network bridge
--bip="" Specify network bridge IP --bip="" Specify network bridge IP
--config=~/.docker Location of client config files
-D, --debug=false Enable debug mode -D, --debug=false Enable debug mode
-d, --daemon=false Enable daemon mode -d, --daemon=false Enable daemon mode
--default-gateway="" Container default gateway IPv4 address --default-gateway="" Container default gateway IPv4 address

View File

@ -35,6 +35,9 @@ To see the man page for a command run **man docker <command>**.
**--bip**="" **--bip**=""
Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b
**--config**=""
Specifies the location of the Docker client configuration files. The default is '~/.docker'.
**-D**, **--debug**=*true*|*false* **-D**, **--debug**=*true*|*false*
Enable debug mode. Default is false. Enable debug mode. Default is false.