Fix build authentication header for API version >= 1.19 #365
+20
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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:
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:
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)