-
Notifications
You must be signed in to change notification settings - Fork 189
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 authenticate with multiple docker registries #239
Comments
Hi, a current workaround/way you can do this is creating multiple providers provider "docker" {
alias = "one"
registry_auth {
address = "registry.internal.example"
config_file = file("~/.docker/config.json")
}
}
provider "docker" {
alias = "two"
registry_auth {
address = "registry.gitlab.com"
config_file = file("~/.docker/config.json")
}
}
resource "docker_image" "nginx" {
provider = "docker.one"
name = "nginx:latest"
} Or is this a feature request? :) |
This issue is stale because it has been open 60 days with no activity. |
Hi, I am currently wondering if this breaking change was intentional. If that’s the case, the documentation is out of date at the moment. |
Hi, The The provided solution of using multiple providers won't work when you need to authenticate to different registries in the same container. For example, pulling from one private registry and pushing to another. |
Yes it was accidentally limited to 1 item in #102 |
@mavogel can you say when this issue will be fixed? |
@mavogel I encountered this unpleasant "feature" when updating the provider. Can you explain why this was done? |
This workaround can be but in limited cases as mentioned before. In general, it only complicates the infrastructure code and requires many changes to existing environments. The concept of a Docker client means multiple credentials for different registries without context switching or creating aliases. So the same behavior was expected (and worked until version |
|
Community Note
Terraform (and docker Provider) Version
Terraform version:
Docker for Mac version:
Affected Resource(s)
docker_image
Terraform Configuration Files
Debug Output
https://gist.github.com/adam-lebon/56444f77c781c44b88caafb01b78da27
Expected Behaviour
As descibe in the documentation, we should be able to configure authentication to multiple registries.
Actual Behaviour
The 2.12.0 release added a new parameter
MaxItems: 1
to the registry_auth block which prevents the usage of multiple private registry.This result in terraform returning a error when validating the provider configuration :
$ terraform apply │ Error: Too many registry_auth blocks │ │ on line 0: │ (source code not available) │ │ No more than 1 "registry_auth" blocks are allowed
Steps to Reproduce
registry_auth
blockdocker_image
resourceterraform apply
References
https://github.com/kreuzwerker/terraform-provider-docker/blob/master/internal/provider/provider.go#L75
The text was updated successfully, but these errors were encountered: