Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading dockercfg files for authenticating with private registries #773

Merged
merged 3 commits into from
Feb 7, 2016

Conversation

diptanu
Copy link
Contributor

@diptanu diptanu commented Feb 6, 2016

Fixed #660 and #702

@dadgar
Copy link
Contributor

dadgar commented Feb 6, 2016

LGTM. Related? #702

@diptanu
Copy link
Contributor Author

diptanu commented Feb 7, 2016

@dadgar Oh yeah #702 is related too. Updating the CHANGELOG too.

diptanu added a commit that referenced this pull request Feb 7, 2016
Reading dockercfg files for authenticating with private registries
@diptanu diptanu merged commit e039d1d into master Feb 7, 2016
@diptanu diptanu deleted the docker-auth branch February 7, 2016 02:03
@trenton42
Copy link

This issue is bigger than just having the https:// on the beginning of the repo address (you should never have to hand edit the auths section of config.json -- that part is generated by docker login). Nomad also looks for the completely wrong thing when looking up auths.

In docker.go it uses repo to look up the auth:

if authConfiguration, ok := authConfigurations.Configs[repo]; ok {
    authOptions = authConfiguration
}

But repo is returned by the docker client and all it does is split the tag from the rest of the docker image path. What this means is that nomad is not just looking for the server address in the auths, it is also looking for the image name. For example, on GCE I might have an image called gcr.io/some-project/some-image:v1.0. If you want this to work right now, you have to put an auth key in for ever single image you run. When nomad tries to look up an auth in config.json, it will look for a key called gcr.io/some-project/some-image, but what docker login actually puts in config.json is:

{
    "auths": {
        "https://gcro.io": {
            "auth": "<some token>",
            "email": "not@val.id"
        }
    }
}

What should happen is either:

  1. Nomad uses authOptions.ServerAddress for the lookup (requires jobs to specify this in their config)
  2. Parse the image name and determine the correct server name

TL;DR neither #660 nor #702 are fixed.

@dadgar dadgar mentioned this pull request Mar 22, 2016
@waziers
Copy link

waziers commented May 2, 2016

@diptanu why is this closed, @trenton42 is correct, this is still broken unless you manually re-write the config.json file

@trenton42
Copy link

trenton42 commented May 2, 2016

@waziers I think this did actually get fixed recently. The hitch I found is that it does look at the SSL flag in the docker driver config of the job, so I had to set that to true.

@diptanu
Copy link
Contributor Author

diptanu commented May 3, 2016

@waziers @trenton42 So what we have implemented there is Nomad to be able to use the dockercfg file specified by an operator. Nomad doesn't automatically do docker login or anything special to re-generate the dockercfg file on ECS, GCP, Quay or any other vendor specific platform currently. We expect the operator to have automation in place for re-generating the file.

The reason why this is hard to do is that the space is very fragmented and every registry provider has created their own way of authenticating with the registry and generate the credentials.

Also as @trenton42 has mentioned, if a registry is behind SSL, the SSL flag has to be set as true.

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants