.docker/config.json vs .dockercfg

Erik picture Erik · Feb 20, 2016 · Viewed 28.5k times · Source

When I do a docker login to a private repository using docker 1.10.1, an entry is created in my ~/.docker/config.json file. Is this file in the same format as what I see being called a .dockercfg file? Is the config.json file interchangeable with a .dockercfg file?

Answer

VonC picture VonC · Feb 22, 2016

I assume config.json is the new .dockercfg file.
See "docker/cliconfig/config.go"

// ConfigFileName is the name of config file
ConfigFileName = "config.json"
oldConfigfile  = ".dockercfg"

The new config file is now documented under man/config-json.5.md

That was introduced in commit 18c9b6c in docker 1.7.0 (April 2015)

Add .docker/config.json and support for HTTP Headers

This PR does the following:

  • migrated ~/.dockerfg to ~/.docker/config.json.
    The data is migrated but the old file remains in case its needed.

Note: since 2016:

It differs from docker-daemon.8.md which uses by default /etc/docker/daemon.json, the daemon configuration file introduced with Docker v1.10.

So:

But the config.json (which applies to all containers) does not include docker run network settings: --net=host could not be specified in that config file.