Skip to content

Instantly share code, notes, and snippets.

@CCFenner
Created September 23, 2020 11:41
Show Gist options
  • Save CCFenner/060ddb98c84463ff4dc101c364774237 to your computer and use it in GitHub Desktop.
Save CCFenner/060ddb98c84463ff4dc101c364774237 to your computer and use it in GitHub Desktop.
Create a configuration file for Docker

To create a valid .docker/config.json file you first need to base64 encode your username and password:

echo <username>:<password> | base64

The output will look like this:

~ echo hallo:welt | base64
aGFsbG86d2VsdAo=

Then you can create your config.json file:

echo '{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "XXX"
    }
  }
}' > config.json

Then open the file and exchange XXX with the encoded username/password you created earlier.

If you need to create a config for another registry, exchange https://index.docker.io/v1/ with the url of the custom registry.

{
"auths": {
"https://index.docker.io/v1/": {
"auth": "XXX"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment