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

Building with tagless name fails with "invalid reference format" #116

Closed
hectorj opened this issue Jan 6, 2021 · 2 comments · Fixed by #117
Closed

Building with tagless name fails with "invalid reference format" #116

hectorj opened this issue Jan 6, 2021 · 2 comments · Fixed by #117
Assignees
Labels
bug Something isn't working r/image Relates to the image resource r/registry_image
Milestone

Comments

@hectorj
Copy link

hectorj commented Jan 6, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and docker Provider) Version

+ provider registry.terraform.io/kreuzwerker/docker v2.9.0

Affected Resource(s)

  • docker_registry_image

Terraform Configuration Files

resource "docker_registry_image" "eshopwebmvc" {
  name = "eu.gcr.io/my-project-id/my-image-name"

  build {
    context    = "."
  }
}

Expected Behaviour

Docker image built and pushed

Actual Behaviour

Error: Error building docker image: Error response from daemon: invalid reference format

Steps to Reproduce

  1. terraform apply

Important Factoids

I did a bit of debugging, and providing a name without a tag gives this internalPushImageOptions

{
    Name: eu.gcr.io/my-project-id/my-image-name
    FqName: eu.gcr.io/my-project-id/my-image-name: 
    Registry: eu.gcr.io 
    NormalizedRegistry: https://eu.gcr.io
    Repository: my-project-id/my-image-name
    Tag:
}

Note the : at the end of FqName.

Building and pushing directly via Docker, it accepts eu.gcr.io/my-project-id/my-image-name and assumes eu.gcr.io/my-project-id/my-image-name:latest, so I expected the same behavior here.

I see a few possible solutions:

  • strip the final : from FqName
  • set a default latest tag
  • return a more precise error to tell the user to always provide a tag
@suzuki-shunsuke
Copy link
Collaborator

Thank you for your report.

@suzuki-shunsuke suzuki-shunsuke added r/registry_image r/image Relates to the image resource labels Jan 6, 2021
@suzuki-shunsuke
Copy link
Collaborator

I have sent a pull request #117

@mavogel mavogel added this to the v2.10.0 milestone Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working r/image Relates to the image resource r/registry_image
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants