[Bug]: builds fail with 'Error: unable to write data to the archive, code 0'
I have done the following
- [x] I have searched the existing issues
- [ ] If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Reproducing this, for me, is a matter of visiting one of my repos that contains my Dockerfile and Makefile, and running something like container build --no-cache --arch amd64 --tag mydomain.com/yeti:latest --file Dockerfile .; (Sorry, that's very me-specific, which is likely unhelpful...)
Current behavior
Since upgrading to 0.11.0, my ability to build containers seems to have broken (macOS Sequoia, 15.7.5). When I run my build command, I see the error below. The command is this: container build --no-cache --arch amd64 --tag mydomain.com/yeti:latest --file Dockerfile .; (the makefile just polls until container is running, which is that bit above the 'Building AMD64 version...')
I've tried removing each flag one-by-one. I've tried uninstalling, purging directories, and reinstalling. The only thing that resolves this is reverting to 0.10.0.
With full acknowledgment that this might be user error, I thought I'd pass this along. Happy to share any additional details as needed!
Neptune ~/D/F/MechanicalYeti (main)> make
Registering API server with launchd...
Verifying apiserver is running...
Waiting for container system to become fully ready...
Container system is fully ready.
Building AMD64 version...
[+] Building 7.3s (2/3)
=> [resolver] fetching image...docker.io/library/node:lts-slim 0.0s
=> [internal] load build definition from Dockerfile 0.4s
=> => transferring dockerfile: 213B 0.3s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 30B 0.3s
Error: unable to write data to the archive, code 0
make[1]: *** [build-container] Error 1
make: *** [default] Error 2
Expected behavior
Historically, with 0.10.0, I'd see a successfully completed build process.
Environment
- OS: macOS 15.7.5
- Container: Container CLI version 0.11.0
Relevant log output
N/A
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Apologies for the noise. Just re-read the Readme, and noticed:
container is supported on macOS 26, since it takes advantage of new features and enhancements to virtualization and networking in this release. We do not support older versions of macOS and the container maintainers typically will not address issues that cannot be reproduced on the macOS 26.
Will close and see how I get on after updating. Thanks for all your work!
Thank you for reporting this issue! We've seen it on macOS 26 as well.
Is it possible for you to share the repo you are using to repro this issue? Completely okay if its not possible
Sure, I'd be happy to. The error happened with these two repos, which are themselves very similiar. (They're silly bots for my friends' Discord server.)
- https://github.com/jdmartin/MechanicalYeti (The one you see in the error above)
- https://github.com/jdmartin/speedybot
In both cases, they would use this build command (changing the tag as appropriate): container build --no-cache --arch amd64 --tag mydomain.com/my_image:latest --file Dockerfile . I tried reducing the command to see if I could find a smoking gun, as it were, by removing --no-cache and then leaving it to the default arm64 architecture, but neither thing succeeded and resulted in the same problem as above.
Thanks for looking into it!
Thanks for sharing. Both these repos build for me with the build command you shared. So I need to keep looking.
Can you tell me little bit more about your environment? Are you running low on disk space by any chance? Can you also tell me the size of your context directory? Simply run du -hs . inside both of your repo directories.
The unable to write data to the archive happens when we try to transfer your build context from your machine to the container, and my guess is that archive is somehow blowing up
Hmm, well, I suppose it's good that it builds for you! :)
So, let's see about disk: Overall free disk space is 1.8TB:
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk3s1s1 3.6Ti 10Gi 1.8Ti 1% 427k 4.3G 0% /
devfs 343Ki 343Ki 0Bi 100% 1.2k 0 100% /dev
/dev/disk3s6 3.6Ti 20Ki 1.8Ti 1% 0 20G 0% /System/Volumes/VM
/dev/disk3s2 3.6Ti 6.9Gi 1.8Ti 1% 1.4k 20G 0% /System/Volumes/Preboot
/dev/disk3s4 3.6Ti 2.6Mi 1.8Ti 1% 60 20G 0% /System/Volumes/Update
/dev/disk1s2 500Mi 6.0Mi 479Mi 2% 1 4.9M 0% /System/Volumes/xarts
/dev/disk1s1 500Mi 5.6Mi 479Mi 2% 30 4.9M 0% /System/Volumes/iSCPreboot
/dev/disk1s3 500Mi 4.5Mi 479Mi 1% 72 4.9M 0% /System/Volumes/Hardware
/dev/disk3s5 3.6Ti 1.8Ti 1.8Ti 49% 4.9M 20G 0% /System/Volumes/Data
map auto_home 0Bi 0Bi 0Bi 100% 0 0 - /System/Volumes/Data/home
For the directories themselves, speedybot reports 72M and yeti reports 44M.
Something very odd just happened, though. In thinking about it, I'm assuming that you probably didn't go through all the unnecessary trouble of trying to run them locally (I mean, why would you, right?). In looking at the .dockerignore, I realized that node_modules was in there. So, after removing the node_modules directory in each folder (so, nothing there to ignore now, but leaving the line in .dockerignore), speedybot and yet build fine. The output looks like this for speedy:
[+] Building 13.5s (10/10) FINISHED
=> [resolver] fetching image...docker.io/library/node:lts-slim 0.0s
=> [internal] load build definition from Dockerfile 0.3s
=> => transferring dockerfile: 206B 0.3s
=> [internal] load .dockerignore 0.2s
=> => transferring context: 59B 0.2s
=> oci-layout://docker.io/library/node:lts-slim@sha256:06e5c9f86bfa0aaa7163cf37a5eaa8805f16b9acb48e3f85645b09d459fc2a9f 2.7s
=> => resolve docker.io/library/node:lts-slim@sha256:06e5c9f86bfa0aaa7163cf37a5eaa8805f16b9acb48e3f85645b09d459fc2a9f 0.0s
=> => sha256:a2f6e997b916eacd77741038edad18ee66944ea69b97f812c88b8e8cd83c6347 443B / 443B 0.0s
=> => sha256:7723618b139f747dbb585f9a357b6f4bad37e18969badd36995d7295695d11dd 3.31kB / 3.31kB 0.0s
=> => sha256:fa08c95eb8d8e6d962ca3433f1f320f0be5f9a5dc95fe9bf493f687d0d8078e5 1.71MB / 1.71MB 0.0s
=> => sha256:708a3e9b9b10d42e2279c6589e334df8261db5918f5a2e082e9d6d1bdc4fbc5c 49.40MB / 49.40MB 0.7s
=> => sha256:6db0909c4473287ed4d1f950d26b8bc5b7b4206d365a0e7740cb89e46979153e 28.24MB / 28.24MB 0.6s
=> => extracting sha256:6db0909c4473287ed4d1f950d26b8bc5b7b4206d365a0e7740cb89e46979153e 0.4s
=> => extracting sha256:7723618b139f747dbb585f9a357b6f4bad37e18969badd36995d7295695d11dd 0.0s
=> => extracting sha256:708a3e9b9b10d42e2279c6589e334df8261db5918f5a2e082e9d6d1bdc4fbc5c 0.7s
=> => extracting sha256:fa08c95eb8d8e6d962ca3433f1f320f0be5f9a5dc95fe9bf493f687d0d8078e5 0.0s
=> => extracting sha256:a2f6e997b916eacd77741038edad18ee66944ea69b97f812c88b8e8cd83c6347 0.0s
=> [internal] load build context 1.3s
=> => transferring context: 22.40MB 1.3s
=> [linux/amd64 1/5] WORKDIR /app 0.2s
=> [linux/amd64 2/5] COPY . . 0.1s
=> [linux/amd64 3/5] RUN npm ci 3.7s
=> [linux/amd64 4/5] RUN mkdir -p /app/db 0.1s
=> exporting to oci image format 1.6s
=> => exporting layers 1.0s
=> => exporting manifest sha256:4adc7ffa4638f559f94400784b15aa0b793e81d89422d322c55c7af575e980f2 0.0s
=> => exporting config sha256:895cea2979784c13bf43744d93042facae953d17bc2915f08f8812f1950c1121 0.0s
=> => exporting manifest list sha256:6fded0f2ee5697cf5e25fe4e9fac25212ecbefa9c9a474d0a1d78d97ecc21be2 0.0s
=> => sending tarball
And for yeti:
[+] Building 12.6s (10/10) FINISHED
=> [resolver] fetching image...docker.io/library/node:lts-slim 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 213B 0.1s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 64B 0.0s
=> oci-layout://docker.io/library/node:lts-slim@sha256:06e5c9f86bfa0aaa7163cf37a5eaa8805f16b9acb48e3f85645b09d459fc2a9f 1.6s
=> => resolve docker.io/library/node:lts-slim@sha256:06e5c9f86bfa0aaa7163cf37a5eaa8805f16b9acb48e3f85645b09d459fc2a9f 0.0s
=> => sha256:7723618b139f747dbb585f9a357b6f4bad37e18969badd36995d7295695d11dd 3.31kB / 3.31kB 0.0s
=> => sha256:a2f6e997b916eacd77741038edad18ee66944ea69b97f812c88b8e8cd83c6347 443B / 443B 0.0s
=> => sha256:fa08c95eb8d8e6d962ca3433f1f320f0be5f9a5dc95fe9bf493f687d0d8078e5 1.71MB / 1.71MB 0.0s
=> => sha256:708a3e9b9b10d42e2279c6589e334df8261db5918f5a2e082e9d6d1bdc4fbc5c 49.40MB / 49.40MB 0.5s
=> => sha256:6db0909c4473287ed4d1f950d26b8bc5b7b4206d365a0e7740cb89e46979153e 28.24MB / 28.24MB 0.4s
=> => extracting sha256:6db0909c4473287ed4d1f950d26b8bc5b7b4206d365a0e7740cb89e46979153e 0.4s
=> => extracting sha256:7723618b139f747dbb585f9a357b6f4bad37e18969badd36995d7295695d11dd 0.0s
=> => extracting sha256:708a3e9b9b10d42e2279c6589e334df8261db5918f5a2e082e9d6d1bdc4fbc5c 0.6s
=> => extracting sha256:fa08c95eb8d8e6d962ca3433f1f320f0be5f9a5dc95fe9bf493f687d0d8078e5 0.0s
=> => extracting sha256:a2f6e997b916eacd77741038edad18ee66944ea69b97f812c88b8e8cd83c6347 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 86.37kB 0.2s
=> [linux/amd64 1/5] WORKDIR /app 0.2s
=> [linux/amd64 2/5] COPY . . 0.0s
=> [linux/amd64 3/5] RUN npm ci --omit-dev 3.5s
=> [linux/amd64 4/5] RUN mkdir -p /app/db 0.1s
=> exporting to oci image format 1.4s
=> => exporting layers 0.9s
=> => exporting manifest sha256:d840ab3ebb688d3277f774068a2895e4d3c6a5795a336155559febe7e4f6653a 0.0s
=> => exporting config sha256:c66e4467089f9a577dacdfbecb51a7424cef8fd48e81f8664aae6905fcc59aa5 0.0s
=> => exporting manifest list sha256:d45c2d1d0e5b6ad665cd51177e6f0d9552af9e2d6c43840e17a4324a08fe598d 0.0s
=> => sending tarball
So, perhaps something about the node_modules directory, or .dockerignore itself, is causing some trouble?
Same error occurred
macOS 26 and Bun Project
% container build
[+] Building 18.1s (3/4)
=> [resolver] fetching image...docker.io/oven/bun:1 0.0s
=> [resolver] fetching image...cgr.dev/chainguard/wolfi-base:latest 0.0s
=> [internal] load build definition from Dockerfile 9.1s
=> => transferring dockerfile: 1.47kB 9.1s
=> [internal] load .dockerignore 9.0s
=> => transferring context: 30B 9.0s
Error: unable to write data to the archive, code 0
something's wrong with .dockerignore I guess
I am on MacOS 26.4 (build: 25E246), and I can confirm I am facing this issue. I did not have issues like this on the version previous to this current one, so I guessing the cause was with the changes bundled into this release.
Here is what I am seeing right now:
ajawad@macintosh a1_autograder ➜ container build --platform linux/aarch64 -t cis1500w26/a1:ta-grader .
[+] Building 14.6s (2/3)
=> [resolver] fetching image...docker.io/library/python:3.14 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 175B 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 0.1s
Error: unable to write data to the archive, code 0
ajawad@macintosh a1_autograder ➜ container build --platform linux/aarch64 -t cis1500w26/a1:ta-grader .
Error: unable to write data to the archive, code 0
ajawad@macintosh a1_autograder ➜ container build --platform linux/aarch64 -t cis1500w26/a1:ta-grader .
[+] Building 0.1s (1/2)
=> [resolver] fetching image...docker.io/library/python:3.14 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 27B 0.1s
Error: unable to write data to the archive, code 0
For what it's worth, I have tried this in a handful of other repos on my system. In all cases, if the node_modules folder is present, and it is included in .dockerignore or .gitignore (which is basically all cases for me), then this error occurs. Removing the folder is the only way to get things to move forward.
Thanks, I can repro this. Taking a look