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

ImageReference should support tag and digest #1481

Closed
briandealwis opened this issue Feb 14, 2019 · 2 comments · Fixed by #2381
Closed

ImageReference should support tag and digest #1481

briandealwis opened this issue Feb 14, 2019 · 2 comments · Fixed by #2381
Assignees
Milestone

Comments

@briandealwis
Copy link
Member

According to the Docker spec, it's ok to have a reference with both a tag and a digest such as ubuntu:latest@sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68

See also: google/go-containerregistry#351

The following test for ImageReferenceTest fails

  @Test
  public void testParse_tagAndDigest() throws InvalidImageReferenceException {
    String imageReferenceString =
        "ubuntu:latest@sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68";
    ImageReference imageReference = ImageReference.parse(imageReferenceString);

    Assert.assertEquals("registry.hub.docker.com", imageReference.getRegistry());
    Assert.assertEquals("ubuntu", imageReference.getRepository());
    Assert.assertEquals("latest", imageReference.getTag());
    Assert.assertEquals(
        "sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68",
        imageReference.getTag());
    Assert.assertTrue(imageReference.isTagDigest());
  }
@TadCordle
Copy link
Contributor

TadCordle commented Apr 20, 2020

@MaartenMoens @jonahgeorge @jhult We've released v2.2.0, which support image references with both a tag and digest.

@chanseokoh
Copy link
Member

Note when using both a tag and a digest (for a base image), the tag is purely for documentation. The digest will determine the image (manifest/manifest list).

For the target image, I think it doesn't make sense to put a digest; you shouldn't do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants