Docker CLI config file locations
Commands use a POSIX shell (macOS, Linux, or WSL). Install the named editor or CLI first. Before using an environment-variable path, check that the variable is set to a non-empty, intended path. When using vi or Notepad, ensure the parent directory exists and is writable. A missing file is created when you save it; Notepad may ask to create it.
Docker uses one configuration directory: --config takes precedence over DOCKER_CONFIG, then the default directory. These files are not merged. Both overrides specify a directory, not a file.
--config directory
First choiceSelects the configuration directory for one command. Replace <directory> with your chosen directory.
Config file location
<directory>/config.jsonReplace <directory> with your chosen configuration directory before running. Keep the surrounding quotes for paths containing spaces.
Command templates
docker --config "<directory>" context showDOCKER_CONFIG directory
Second choiceUsed when DOCKER_CONFIG is non-empty and --config is not supplied.
Config file location
Only use this command when DOCKER_CONFIG is set.$DOCKER_CONFIG/config.jsonCommands
vi "$DOCKER_CONFIG/config.json"Default user directory
Default locationUsed when neither directory override is supplied.
Config file location
The file may not exist until configuration is saved. Docker Engine and Desktop settings are separate.~/.docker/config.jsonCommands
vi "$HOME/.docker/config.json"
Official Docker CLI documentation