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 a stage using image with both tag and SHA digest fails #535

Closed
martin-sucha opened this issue Jan 20, 2019 · 7 comments · Fixed by #599
Closed

Building a stage using image with both tag and SHA digest fails #535

martin-sucha opened this issue Jan 20, 2019 · 7 comments · Fixed by #599

Comments

@martin-sucha
Copy link

Actual behavior
With a Dockerfile containing a stage like this:

FROM ubuntu:latest@sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68

Kaniko fails with the following message:

Downloading base image ubuntu:latest@sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68 
error building image: getting stage builder for stage 0: could not parse reference

Expected behavior
Since Docker itself can build the image from the Dockerfile, I expect kaniko to be able to do the same.

To Reproduce
Steps to reproduce the behavior:

  1. echo "FROM ubuntu:latest@sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68" >Dockerfile
  2. docker run -v "$(pwd):/workspace" gcr.io/kaniko-project/executor:debug@sha256:901f53b350d0681d1fcde2654bdab048610428e1150beda51acb76fedd62ad85 --dockerfile Dockerfile --destination test
@martin-sucha
Copy link
Author

The error comes from ParseReference in go-containerregistry. The function can't parse image references with both tag and SHA.

@everflux
Copy link

everflux commented Feb 2, 2019

Could this be related to the failure with multi-arch images when the manifest points to tag-hash-image?
I resolved the nginx:alpine arm image to docker.io/library/nginx:alpine@sha256:88f143e0196aad3eb20c56a4c78f55881de72c2e688ebc87eacfacaa734bc8db and the build failes with

INFO[1461] Error while retrieving image from cache: could not parse reference 
INFO[1461] Downloading base image docker.io/library/nginx:alpine@sha256:88f143e0196aad3eb20c56a4c78f55881de72c2e688ebc87eacfacaa734bc8db 
error building image: getting stage builder for stage 1: could not parse reference

@viceice
Copy link

viceice commented Mar 3, 2019

Any chances to get this working soon? This is a blocker for me.

@priyawadhwa
Copy link
Collaborator

Hey @viceice , based on this comment I think somebody will have to open a PR in go-containerregistry with the fix for this to work.

@viceice
Copy link

viceice commented Mar 4, 2019

Looks like I have to learn go to get this fixed. 😁

@viceice
Copy link

viceice commented Mar 5, 2019

Done 😁

google/go-containerregistry#391

@viceice
Copy link

viceice commented Mar 5, 2019

Merged 😁

priyawadhwa pushed a commit to priyawadhwa/kaniko that referenced this issue Mar 5, 2019
Update go-containerregistry since it can now handle image names of the
format repo:tag@digest.

Should fix GoogleContainerTools#535.

Thanks @viceice for the fix!
dlorenc pushed a commit that referenced this issue Mar 6, 2019
* Update go-containerregistry

Update go-containerregistry since it can now handle image names of the
format repo:tag@digest.

Should fix #535.

Thanks @viceice for the fix!

* update go-containerregistry again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants