Windows: Build images with windows-host-process-containers-base-image fails with Cannot create a file when that file already exists. (0xb7): unknown
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- docker, github-actions, go
- Domain
- build-system, devops, operating-systems
Research direction
Start by reproducing the GitHub Actions workflow with containerd 1.7.20, BuildKit v0.15.0, and the remote buildx driver. Trace the export failure at hcsshim::ImportLayer during snapshot finalization, using the Dockerfile and reported 0xb7 error as the test case. Done means the host-process base image builds and exports without the duplicate-file error.
Written by the indexing model from the issue text.
Description
I tried to build a https://github.com/microsoft/windows-host-process-containers-base-image/ which is considered as special.
windows-host-process-containers-base-image is a very special image, because its hand-crafted image.
I'm using Github Actions to build an images on top of windows-host-process-containers-base-image
Here are the actions I'm using:
- name: Setup containerd
run: |
$version = "1.7.20"
curl.exe -L https://github.com/containerd/containerd/releases/download/v$version/containerd-$version-windows-amd64.tar.gz -o containerd.tar.gz
tar.exe xvf containerd.tar.gz
.\bin\containerd.exe --register-service
Start-Service containerd
- name: Setup BuildKit
run: |
$version = "v0.15.0"
curl.exe -L https://github.com/moby/buildkit/releases/download/$version/buildkit-$version.windows-amd64.tar.gz -o buildkit.tar.gz
tar.exe xvf buildkit.tar.gz
.\bin\buildkitd.exe --register-service
Start-Service buildkitd
- name: Setup Docker Buildx
run: |
$version = "v0.16.1"
curl.exe -L https://github.com/docker/buildx/releases/download/$version/buildx-$version.windows-amd64.exe -o $env:ProgramData\Docker\cli-plugins\docker-buildx.exe
- uses: docker/setup-buildx-action@v3
with:
driver: remote
endpoint: npipe:////./pipe/buildkitd
While build looks fine, exporting the images causes unknown errors:
docker buildx build --push --build-arg=BASE=mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 -f Dockerfile -t ghcr.io/prometheus-community/windows-exporter:master-hostprocess .
#0 building with "builder-e1408480-a0f9-48a2-aa8d-31bc0261d2ff" instance using remote driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 490B done
#1 DONE 0.0s
#2 [internal] load metadata for mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0
#2 DONE 0.1s
#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s
#4 [internal] load build context
#4 transferring context: 115B done
#4 DONE 0.0s
#5 [1/2] FROM mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0@sha256:b4c9637e032f667c52d1eccfa31ad8c63f1b035e8639f3f48a510536bf34032b
#5 resolve mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0@sha256:b4c9637e032f667c52d1eccfa31ad8c63f1b035e8639f3f48a510536bf34032b
#5 resolve mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0@sha256:b4c9637e032f667c52d1eccfa31ad8c63f1b035e8639f3f48a510536bf34032b 0.1s done
#5 DONE 0.1s
#6 [2/2] COPY output/amd64/windows_exporter.exe /windows_exporter.exe
#6 CACHED
#7 exporting to image
#7 exporting layers
#7 exporting layers 0.2s done
#7 ERROR: failed to commit 5am92igktp6scjpj0kc7ejaj3 to oumlt8yasx34v7sb7a31zzo9f during finalize: failed to reimport snapshot: hcsshim::ImportLayer failed in Win32: Cannot create a file when that file already exists. (0xb7): unknown
------
> exporting to image:
------
ERROR: failed to solve: failed to commit 5am92igktp6scjpj0kc7ejaj3 to oumlt8yasx34v7sb7a31zzo9f during finalize: failed to reimport snapshot: hcsshim::ImportLayer failed in Win32: Cannot create a file when that file already exists. (0xb7): unknown
Dockerfile, mention that BASE will be overwrite by --build-arg:
ARG BASE="mcr.microsoft.com/windows/nanoserver:ltsc2022"
FROM $BASE
ENV PATH="C:\Windows\system32;C:\Windows;"
COPY output/amd64/windows_exporter.exe /windows_exporter.exe
ENTRYPOINT ["windows_exporter.exe"]
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from moby/buildkit
-
status/triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
area/dockerfile
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100