Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 79cf073

Browse files
adrian-platathaJeztah
authored andcommitted
Clarifying docker config rules
Signed-off-by: Adrian Plata <adrian.plata@docker.com> (cherry picked from commit 131eefc54f9c8afaef8d7138770303eff26d9201) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 82ac89901fae93b4bb8db5aadbd1f1bb8b4a5391 Component: cli
1 parent 0123322 commit 79cf073

1 file changed

Lines changed: 47 additions & 15 deletions

File tree

  • components/cli/docs/reference/commandline

components/cli/docs/reference/commandline/cli.md

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,43 @@ variables.
9696
### Configuration files
9797

9898
By default, the Docker command line stores its configuration files in a
99-
directory called `.docker` within your `$HOME` directory. However, you can
100-
specify a different location via the `DOCKER_CONFIG` environment variable
101-
or the `--config` command line option. If both are specified, then the
102-
`--config` option overrides the `DOCKER_CONFIG` environment variable.
103-
For example:
104-
105-
docker --config ~/testconfigs/ ps
106-
107-
Instructs Docker to use the configuration files in your `~/testconfigs/`
108-
directory when running the `ps` command.
99+
directory called `.docker` within your `$HOME` directory.
109100

110101
Docker manages most of the files in the configuration directory
111102
and you should not modify them. However, you *can modify* the
112103
`config.json` file to control certain aspects of how the `docker`
113104
command behaves.
114105

115-
Currently, you can modify the `docker` command behavior using environment
106+
You can modify the `docker` command behavior using environment
116107
variables or command-line options. You can also use options within
117-
`config.json` to modify some of the same behavior. When using these
118-
mechanisms, you must keep in mind the order of precedence among them. Command
119-
line options override environment variables and environment variables override
120-
properties you specify in a `config.json` file.
108+
`config.json` to modify some of the same behavior. If an environment variable
109+
and the `--config` flag are set, the flag takes precedent over the environment
110+
variable. Command line options override environment variables and environment
111+
variables override properties you specify in a `config.json` file.
112+
113+
114+
#### Change the `.docker` directory
115+
116+
To specify a different directory, use the `DOCKER_CONFIG`
117+
environment variable or the `--config` command line option. If both are
118+
specified, then the `--config` option overrides the `DOCKER_CONFIG` environment
119+
variable. The example below overrides runs the `docker ps` command using a
120+
`config.json` file located in the `~/testconfigs/` directory.
121+
122+
```bash
123+
$ docker --config ~/testconfigs/ ps
124+
```
125+
126+
This flag only applies to whatever command is being ran. For persistent
127+
configuration, you can set the `DOCKER_CONFIG` environment variable in your
128+
shell (e.g. `~/.profile` or `~/.bashrc`). The example below sets the new
129+
directory to be `HOME/newdir/.docker`.
130+
131+
```bash
132+
echo export DOCKER_CONFIG=$HOME/newdir/.docker > ~/.profile
133+
```
134+
135+
#### `config.json` properties
121136

122137
The `config.json` file stores a JSON encoding of several properties:
123138

@@ -265,6 +280,23 @@ Following is a sample `config.json` file:
265280
{% endraw %}
266281
```
267282

283+
### Experimental features
284+
285+
To enable experimental features, edit the `config.json` file and set
286+
`experimental` to `enabled`. The example below enables experimental features
287+
in a `config.json` file that already enables a debug feature.
288+
289+
```json
290+
{
291+
"experimental": "enabled",
292+
"debug": true
293+
}
294+
```
295+
296+
You can also enable experimental features from the Docker Desktop menu. See the
297+
[Docker Desktop Getting Started page](https://docs.docker.com/docker-for-mac#experimental-features)
298+
for more information.
299+
268300
### Notary
269301

270302
If using your own notary server and a self-signed certificate or an internal

0 commit comments

Comments
 (0)