dotnet / dotnet/docker-tools

Build command doesn't work in some scenarios with containerd image store

Open
#1,517 8 comments 0 reactions 1 assignee Claimed by @lbussell View on GitHub
area-infrastructure
Dominant language
C#
Stars
181
Forks
67
Avg merge
2d 15h
Merged PRs (30d)
10

Description

While attempting to fix https://github.com/dotnet/docker-tools/issues/1516 I was trying to run my fix locally with the configuration that would verify it was working (i.e. image caching was enabled). It ended up not working correctly because some of the logic in Image Builder was not getting the expected results from the locally built image.

This logic expects that a locally built image will not have a digest associated with it from the `docker inspect` command: https://github.com/dotnet/docker-tools/blob/008a7cf2b73cf7af715f9e692cfd84911da693b0/src/Microsoft.DotNet.ImageBuilder/src/IManifestService.cs#L41-L47

This turns out not to be the case for my version of Docker Desktop. In other words, the image _does_ have a digest for the locally built image. This causes issues later on in that method because it will attempt to verify the digest reflects what is the registry (because it assumes it is not a locally built image at this point):

https://github.com/dotnet/docker-tools/blob/008a7cf2b73cf7af715f9e692cfd84911da693b0/src/Microsoft.DotNet.ImageBuilder/src/IManifestService.cs#L49-L62

This then throws the exception because the digests don't match which makes sense.

So at some point, a new version of Docker (not sure if this is in the client or server) caused the digest to be created. You can see this in the build output:

![Image](https://github.com/user-attachments/assets/ced8d872-ee6e-4b17-a382-448da60556dd)

This differs from the behavior of the version of Docker installed on the build agents. But this will become an issue whenever they get updated to whichever version this behavior was introduced.

For reference, here's my `docker info` output for my Docker Desktop installation:

```
Client:
Version: 27.3.1
Context: desktop-linux
Debug Mode: false
Plugins:
ai: Ask Gordon - Docker Agent (Docker Inc.)
Version: v0.1.0
Path: C:\Users\mthalman\.docker\cli-plugins\docker-ai.exe
buildx: Docker Buildx (Docker Inc.)
Version: v0.18.0-desktop.2
Path: C:\Users\mthalman\.docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.30.3-desktop.1
Path: C:\Users\mthalman\.docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.37
Path: C:\Users\mthalman\.docker\cli-plugins\docker-debug.exe
desktop: Docker Desktop commands (Alpha) (Docker Inc.)
Version: v0.0.15
Path: C:\Users\mthalman\.docker\cli-plugins\docker-desktop.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: C:\Users\mthalman\.docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.27
Path: C:\Users\mthalman\.docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.5
Path: C:\Users\mthalman\.docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: C:\Users\mthalman\.docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Users\mthalman\.docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.15.0
Path: C:\Users\mthalman\.docker\cli-plugins\docker-scout.exe

Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 22
Server Version: 27.3.1
Storage Driver: overlayfs
driver-type: io.containerd.snapshotter.v1
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 nvidia runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 472731909fa34bd7bc9c087e4c27943f9835f111
runc version: v1.1.13-0-g58aa920
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.167.4-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 31.32GiB
Name: docker-desktop
ID: 853347f3-b3ff-446d-a665-c790a3d9585d
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=npipe://\\.\pipe\docker_cli
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
```

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.