Skip to content

FR: Read /etc/docker/config.json in addition to ~/.docker/config.json #2738

Open

Description

@ChristianTackeGSI

As a sysadmin, I would like to set some options globally for all users.

So it would be good, if the logic reading ~/.docker/config.json would also read /etc/docker/config.json and merge the results.

When it comes to precedences, I think, the user's config should override the system config.

My major use case are proxies (see #93). Asking every user to configure them by hand is not optimal.

Activity

  1. thaJeztah commented on Sep 22, 2020

    @thaJeztah
    Member

    Thanks for your proposal. I agree that the configuration should be more "modular", so allow setting (system-wide) defaults, but also allowing overrides (per user and/or even per project (I proposed a .docker directory in some conversations that could be included in your project and could contain (all) docker-related files) or context; see #1621)

    We'll likely have to consider following https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html (for Linux at least; macOS and Windows t.b.d. on paths/priority)

  2. ChristianTackeGSI commented on Sep 22, 2020

    @ChristianTackeGSI
    Author

    +1 for XDG Base Dir in general! (uncluttering $HOME)

    Following XDG Basedir fully would introduce something like /etc/xdg/docker/, while we already have /etc/docker/ (for daemon.json and key.json). So maybe the search path for config.json should include both?

  3. RobertIndie commented on Oct 21, 2020

    @RobertIndie

    But how do we handle the case of changing and saving configuration files? Like using docker context use, docker context rm, docker login or docker logout.

  4. ChristianTackeGSI commented on Oct 21, 2020

    @ChristianTackeGSI
    Author

    docker login writes to the user's local ~/.docker/config.json. (Or in XDG world to ~/.config/docker/config.json)

    The files in /etc/ should be read before the user's ones, so that the settings of the user overrides the system's one.
    The idea is, that the system administrator wants to set sane defaults for things.

  5. RobertIndie commented on Nov 2, 2020

    @RobertIndie

    I'm interested to work on this.

  6. fede843 commented on Apr 30, 2024

    @fede843

    Is there any update on this one?

  7. darkhelmet commented on Oct 9, 2025

    @darkhelmet

    I just fought with this for a few hours today because I thought "obviously I should be able to configure a global /etc/docker/config.json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions