Skip to content

emulator: replace docker save/nuke/reload with in-place prune#1329

Closed
BilalG1 wants to merge 3 commits into
emulator-arm64-ubuntu-runnerfrom
emulator-arm64-skip-docker-nuke-reload
Closed

emulator: replace docker save/nuke/reload with in-place prune#1329
BilalG1 wants to merge 3 commits into
emulator-arm64-ubuntu-runnerfrom
emulator-arm64-skip-docker-nuke-reload

Conversation

@BilalG1
Copy link
Copy Markdown
Collaborator

@BilalG1 BilalG1 commented Apr 13, 2026

After flattening, reclaim intermediate layers with docker rmi + docker image prune -af rather than round-tripping the final image through a tar and wiping /var/lib/docker. The round-trip cost ~15 min under same-arch TCG on the arm64 runner because every byte of the image is read, written to tar, then read and written back. Relies on the drive's discard=on,detect-zeroes=unmap + fstrim to return freed clusters to the qcow2, which also lets the zero-fill dd go.

After flattening, reclaim intermediate layers with `docker rmi` +
`docker image prune -af` rather than round-tripping the final image
through a tar and wiping /var/lib/docker. The round-trip cost ~15 min
under same-arch TCG on the arm64 runner because every byte of the
image is read, written to tar, then read and written back. Relies on
the drive's `discard=on,detect-zeroes=unmap` + fstrim to return freed
clusters to the qcow2, which also lets the zero-fill `dd` go.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c803417b-d33c-4dab-b7c8-5f7f4f10ef16

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch emulator-arm64-skip-docker-nuke-reload

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-auth-hosted-components Ready Ready Preview, Comment Apr 13, 2026 7:31pm
stack-backend Ready Ready Preview, Comment Apr 13, 2026 7:31pm
stack-dashboard Ready Ready Preview, Comment Apr 13, 2026 7:31pm
stack-demo Ready Ready Preview, Comment Apr 13, 2026 7:31pm
stack-docs Ready Ready Preview, Comment Apr 13, 2026 7:31pm
stack-preview-backend Ready Ready Preview, Comment Apr 13, 2026 7:31pm
stack-preview-dashboard Ready Ready Preview, Comment Apr 13, 2026 7:31pm

With -a, docker image prune removes every image that isn't referenced
by a running or stopped container. At this point in provisioning the
flatten container has been rm'd and stack.service is only enabled
(not started), so the freshly-tagged stack-local-emulator image has
zero container refs and was getting nuked. The VM then booted cleanly
but stack.service failed to `docker run` the image on startup,
producing a green systemd log with no services reachable on their
ports — the symptom we saw in the amd64 run.

Drop -a so we only prune dangling (untagged) images. The explicit
rmi of the fat + slim intermediates still leaves them dangling, so
they still get reclaimed.
The Start/Verify/Stop emulator steps boot the freshly-built qcow2 and
wait for all services — including the Next.js backend — to respond on
their ports. Under same-arch TCG on ubuntu-24.04-arm there's no KVM,
so the backend can't come up within any reasonable window (this is the
same reason the build-time smoke test is already skipped on arm64).
Today the step just burns the 53-minute EMULATOR_READY_TIMEOUT and
fails.

Gate those three steps to amd64. The build step still fully produces
and validates the arm64 image; it just doesn't try to run it under
emulation. The amd64 job continues to prove the image's service stack
end-to-end, and the arm64 artifact is trusted to be equivalent since
real arm64 hardware has KVM.
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 this pull request may close these issues.

1 participant