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

Fix build authentication header for API version >= 1.19 #365

Merged
merged 1 commit into from
Sep 2, 2015

Conversation

csrwng
Copy link
Contributor

@csrwng csrwng commented Sep 1, 2015

The format for the map used by Docker to read auth configs on the BuildImage API call has changed twice since Docker 1.6.x (API version 1.18):

In Docker 1.6.2 (API version 1.18), it uses this format:

{ "configs": { auth config map } }

Defined here: https://github.com/docker/docker/blob/v1.6.2/registry/auth.go#L37-L40
Decoded here: https://github.com/docker/docker/blob/v1.6.2/api/server/server.go#L1043

In Docker 1.7.0 (API version 1.19), it uses this format:

{ "auths": { auth config map } }

Defined here: https://github.com/docker/docker/blob/v1.7.0/cliconfig/config.go#L41-L45
Decoded here: https://github.com/docker/docker/blob/v1.7.0/api/server/server.go#L1218

In Docker 1.7.1 and later (still API version 1.19), it uses this format:

{ auth config map }

Decoded here: https://github.com/docker/docker/blob/v1.7.1/api/server/server.go#L1227

This PR allows go-dockerclient to support the most recent format based on detecting API version 1.19 and above. It ignores the format in Docker 1.7.0 since it was there only for a single version and it was quickly replaced in 1.7.1 (and there wasn't a change in API version)

@csrwng
Copy link
Contributor Author

csrwng commented Sep 1, 2015

@bparees @ncdc fyi

@fsouza
Copy link
Owner

fsouza commented Sep 2, 2015

Nice catch, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants