dotnet / dotnet/docker-tools

Use of `library` repo in base image name results in digest diff

Open
#1,363 2 comments 1 reaction 0 assignees View on GitHub
area-infrastructure up-for-grabs
Dominant language
C#
Stars
181
Forks
67
Avg merge
2d 15h
Merged PRs (30d)
10

Description

From the [buildtools-prereqs repo](https://github.com/dotnet/dotnet-buildtools-prereqs-docker), run this command: `.\build.ps1 -DockerfilePath "*almalinux/8/source-build/amd64*"`. It results in the following exception:

```
Unhandled exception: System.InvalidOperationException: Found published digest 'sha256:e87da8566de5f0a10e0e6acdb7ca43da4ef97a114130691d7dd737d6923c863d' for tag 'library/almalinux:8' but could not find a matching digest value from the set of locally pulled digests for this tag: almalinux@sha256:e87da8566de5f0a10e0e6acdb7ca43da4ef97a114130691d7dd737d6923c863d. This most likely means that this tag has been updated since it was last pulled.
at Microsoft.DotNet.ImageBuilder.ManifestServiceExtensions.GetImageDigestAsync(IInnerManifestService manifestService, String image, Boolean isDryRun) in /image-builder/src/ManifestServiceExtensions.cs:line 58
```

This happens because of the use of the [`library` repo in the Dockerfile's base image name](https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/d989347c9421ff710ad5120868709a11f9b3a008/src/almalinux/8/source-build/amd64/Dockerfile#L1) which was done in order to work around https://github.com/dotnet/docker-tools/issues/1341. The logic in Image Builder uses that image name to get the digest of the locally pulled image, but the output of that command has `library/` stripped from the name:

```
-- EXECUTING: docker inspect library/almalinux:8 -f "{{ index .RepoDigests }}"
[almalinux@sha256:e87da8566de5f0a10e0e6acdb7ca43da4ef97a114130691d7dd737d6923c863d]
```

This leads to a diff with the expected digest (e.g. `library/almalinux@sha256:e87da8566de5f0a10e0e6acdb7ca43da4ef97a114130691d7dd737d6923c863d`), resulting in the exception being thrown.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.