-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Better Docker Auth lookup #2190
Conversation
// authOptionsFrom takes the Docker auth config file and the repo being pulled | ||
// and returns an AuthConfiguration or an error if the file/repo could not be | ||
// parsed or looked up. | ||
func authOptionFrom(file, repo string) (*docker.AuthConfiguration, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see a test for this. Hard to follow what this method expects to return the right AuthConfiguration.
return nil, fmt.Errorf("Failed to parse repository: %v", err) | ||
} | ||
|
||
f, err := os.Open(file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please close the file once you are done using it.
This commit adds a test to retrieving auth configurations, use either the auth block in the config or specified via the agent config and adds a log if lookup fails.
How we can pass that ? |
if we have nomad cluster |
If i want to add in client.hcl or server.hcl |
You add to client.hcl:
|
thanks dadgar |
Yes 0.5.3 or greater should have this. Later versions of Nomad have fixed small bugs relating to this so would suggest running 0.5.6. |
Hi, According to nomad documentation I should be able to do this
and get a docker image from my login protected private docker registry.
It looks like nomad ignores the server_address I've speicified. Am I doing something wrong? Nomad version: 0.5.4 Thanks for your help |
Hey we are passing through that setting to the docker api client, which passes through to docker. Looks like they aren't honoring that and instead just parse the image name to detect the registry. I believe an example was given on the mailing list. |
Thanks, I've used the mailing list advice and this works. |
Just for anyone coming here to solve this issue config {
image = "https://my.docker.registry.com/hello/world:latest"
auth {
username = "testuser"
password = "testpassword"
}
}
|
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. |
This PR brings Nomad's Docker Auth lookup in sync with Docker's own implementation.
Fixes #2003
Fixes #1662