Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

resource docker_image with sha256 tag results in API error (400) #79

Closed
haai opened this issue Jul 10, 2018 · 2 comments
Closed

resource docker_image with sha256 tag results in API error (400) #79

haai opened this issue Jul 10, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@haai
Copy link

haai commented Jul 10, 2018

I am trying to use a sha256 hash tag to reference an image to avoid pulling a tampered image. But it seems that the docker provider does not work with this tag.

Terraform Version

$ terraform version
Terraform v0.11.7
+ provider.docker v0.1.1

Affected Resource(s)

resource docker_image

Terraform Configuration Files

resource "docker_image" "gitlab" {
  name = "gitlab/gitlab-ce@sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c"
}

Expected Behavior

The image should be pulled like the docker pull command is doing the same.

Actual Behavior

API error (400)

* docker_image.gitlab: 1 error(s) occurred:

* docker_image.gitlab: Unable to read Docker image into resource: Unable to pull image gitlab/gitlab-ce@sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c: Error pulling image gitlab/gitlab-ce@sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c: API error (400): {"message":"invalid reference format"}

Steps to Reproduce

use a docker_image resource with a sha256 tag, like gitlab/gitlab-ce@sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c

References

use the docker CLI with the tag does work

$ docker pull gitlab/gitlab-ce@sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c
sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c: Pulling from gitlab/gitlab-ce
b234f539f7a1: Pull complete
55172d420b43: Pull complete
5ba5bbeb6b91: Pull complete
43ae2841ad7a: Pull complete
f6c9c6de4190: Pull complete
60fed0f57f41: Pull complete
c9dd8de9d2b3: Pull complete
073411baabf1: Pull complete
5b4d66ff18f7: Pull complete
d140a401cbc5: Pull complete
eb4ac2293653: Pull complete
Digest: sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c
Status: Downloaded newer image for gitlab/gitlab-ce@sha256:f54ce2fd5011331b42ecc0b018caae700d36c9c9b5811eef9982d4d1b21c719c
@mavogel mavogel added this to the v1.0.1 milestone Jul 10, 2018
@mavogel mavogel added the bug label Jul 10, 2018
@mavogel
Copy link
Contributor

mavogel commented Jul 10, 2018

@haai will investigate. just checked with provider.docker v.1.0.0 and it pulls but thrown another error although the image is then listed in docker images

mavogel added a commit that referenced this issue Oct 12, 2018
* adds repo digests to local image structure. Closes #79 
* updates CHANGELOG
@mavogel mavogel self-assigned this Oct 12, 2018
@haai
Copy link
Author

haai commented Oct 23, 2018

top :) thx @mavogel

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants