Docker CLI config file locations
Find Docker CLI config.json locations and configuration directory precedence on macOS, Linux, and Windows.
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.jsonCommands
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