Config File Locator

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.

  1. --config directory

    First choice

    Selects the configuration directory for one command. Replace <directory> with your chosen directory.

    Config file location
    <directory>/config.json
    Commands
    docker --config "<directory>" context show
  2. DOCKER_CONFIG directory

    Second choice

    Used when DOCKER_CONFIG is non-empty and --config is not supplied.

    Config file location
    $DOCKER_CONFIG/config.json
    Only use this command when DOCKER_CONFIG is set.
    Commands
    vi "$DOCKER_CONFIG/config.json"
  3. Default user directory

    Default location

    Used when neither directory override is supplied.

    Config file location
    ~/.docker/config.json
    The file may not exist until configuration is saved. Docker Engine and Desktop settings are separate.
    Commands
    vi "$HOME/.docker/config.json"

Official Docker CLI documentation