-
Notifications
You must be signed in to change notification settings - Fork 190
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
Cannot push on registry with auth disabled #470
Comments
Near as I can tell, the V2 registry wants something for the HTTP header X-Registry-Auth when pushing to registries that don't other have auth (most private registry configurations). I, as a test, hacked in: // start with a dummy because no-auth requires *something*
auth := types.AuthConfig{Username: "yourname", Password: "pasword"}
if username != "" {
auth = types.AuthConfig{Username: username, Password: password}
}
authBytes, err := json.Marshal(auth)
if err != nil {
return fmt.Errorf("Error creating push options: %s", err)
}
authBase64 := base64.URLEncoding.EncodeToString(authBytes)
pushOptions.RegistryAuth = authBase64 at Reference: https://stackoverflow.com/a/40677022 and I'll add it as a PR, but there's definitely some fragility around this and I don't know how to plumb in access from a config. |
I think there is a confusion x-registry-auth seems to be a header pass to docker daemon/engine to interact with docker registry but docker registry actually wants a bearer token as explained here : https://docs.docker.com/registry/spec/auth/token/ and here https://docs.docker.com/engine/api/v1.41/#section/Versioning |
Community Note
Terraform (and docker Provider) Version
v1.3.1
Affected Resource(s)
docker_registry_image
Terraform Configuration Files
Expected Behaviour
When using
docker push my_private_docker_image
on a private registry with auth disabled, push succeed without specifying anything.Actual Behaviour
It prompt an error:
Error: Error pushing docker image: Error response from daemon: Bad parameters and missing X-Registry-Auth: EOF
I've also try to add empty username and password on the registry_auth block and it doesn't work either.
Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: