Skip to content

fix(DM01-6060): use emptyDir for /root/.docker to fix docker build and login#624

Closed
liuwei08 wants to merge 3 commits into
masterfrom
revert-622-revert-619-DM01-6060
Closed

fix(DM01-6060): use emptyDir for /root/.docker to fix docker build and login#624
liuwei08 wants to merge 3 commits into
masterfrom
revert-622-revert-619-DM01-6060

Conversation

@liuwei08

@liuwei08 liuwei08 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #619 introduced two bugs when docker_config_secret is set:

  1. docker login fails with: rename /root/.docker/config.json<random> /root/.docker/config.json: device or resource busy

    • Root cause: subPath mounts the secret file as a bind mount on container rootfs (overlayfs), but docker's temp file is also on rootfs — rename crosses device boundaries with the secret tmpfs.
  2. docker build fails with: mkdir /root/.docker/buildx: read-only file system

    • Root cause: mounting the secret directory to /root/.docker makes the whole directory read-only.

Fix

  • Mount the docker config secret to /tmp/docker-secret (read-only, no conflict)
  • Add an emptyDir volume mounted at /root/.docker (writable)
  • In entrypoint.sh, copy /tmp/docker-secret/config.json/root/.docker/config.json before the docker daemon starts

This ensures:

  • cgr.dev credentials are present at container start (no explicit login needed)
  • docker login can write/rename within the same emptyDir filesystem
  • docker build can create subdirectories under /root/.docker/

liuwei08 and others added 3 commits July 2, 2026 10:40
Mount docker config secret to /tmp/docker-secret (read-only) and
use emptyDir for /root/.docker (writable). Copy config.json in
entrypoint.sh before docker daemon starts.

This fixes two issues:
- docker login rename failing across devices (subPath bind mount)
- docker build mkdir /root/.docker/buildx: read-only file system
@liuwei08 liuwei08 closed this Jul 2, 2026
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