HolyClaude icon indicating copy to clipboard operation
HolyClaude copied to clipboard

[Podman rootless] Cannot get bidirectional read/write access to ./workspace between host and container

Open SmoothHalo opened this issue 5 months ago • 4 comments

Image Variant

Full (latest / dev)

Image Tag / Version

latest

Host OS

Linux

What happened?

Environment

  • Host OS: Fedora (rootless Podman)
  • Podman version: 5.8.2
  • Compose runner: podman compose / docker-compose vía podman
  • Image: coderluii/holyclaude:latest
  • SELinux: enforcing

Problem

When I mount ./workspace:/workspace as a bind mount, files created by claude inside the container end up owned by a very high UID on the host (e.g. 525287), which prevents me from editing them from the host as my normal user (UID 1000, e.g. via VS Code).

If I chown the host directory to my own UID/GID, the container loses write access to /workspace instead.

podman top holyclaude user huser confirms the expected rootless behavior — the claude process (UID 1000 inside the container) maps to UID 525287 on the host, which is consistent with my subuid range in /etc/subuid.

What I've already tried

  1. PUID=1000 / PGID=1000 env vars as documented in troubleshooting.md → No effect on host-side ownership. This makes sense given that PUID/PGID only affects UID mapping inside the container's own user namespace, not the host-visible UID under rootless Podman (unlike classic Docker where container UID == host UID).

  2. :U volume flag on ./workspace → Podman re-chowns the host directory to match the container's user namespace, but then I lose write access from the host again.

  3. podman unshare chown -R 1000:1000 ./workspace → As expected from rootless namespace semantics, this results in the host directory being owned by UID 525287 (my subuid-mapped UID 1000), not my real host UID 1000. So it fixes container-side access but not host-side access.

  4. userns_mode: keep-id + user: "1000:1000" in compose → This maps my real host UID into the container, which should solve this. But it broke the s6-overlay bootstrap: runuser: may not be used by non-root users s6-applyuidgid: fatal: unable to set supplementary group list: Operation not permitted

It looks like s6-applyuidgid's setgroups() call fails under userns=keep-id because root inside the container namespace doesn't have full CAP_SETGID in that mode.

Question for maintainer

  • Is HolyClaude expected to work with --userns=keep-id in rootless Podman? If so, would adding -Z to the s6-applyuidgid calls in the s6-rc.d run scripts (to skip supplementary group handling) be a safe fix, or does the entrypoint rely on those groups for something?
  • Alternatively, is there a documented/recommended approach for bidirectional host+container editing of /workspace specifically for rootless Podman users (as opposed to Docker, where PUID/PGID works directly because container UID == host UID)?

Happy to test a patched image or provide more logs if useful.

What did you expect?

I expected that setting PUID=1000 and PGID=1000 (as documented in docs/troubleshooting.md) would result in files created by claude inside /workspace being owned by UID 1000 on the host as well, so that I could edit them directly from my host user (also UID 1000) in VS Code, while claude inside the container retains write access to the same files.

Instead, files created inside /workspace show up on the host owned by a high UID (525287), which is not writable/editable by my host user without sudo. This appears to happen because, under rootless Podman, container UID 1000 maps through /etc/subuid to a host-side subordinate UID rather than to my real host UID — unlike Docker, where container UID 1000 is literally the same number as host UID 1000.

Steps to reproduce

  1. Run podman --version (tested with Podman rootless on Fedora, SELinux enforcing).

  2. Use this docker-compose.yaml (bind mount + PUID/PGID as documented in troubleshooting.md):

    volumes:

    • ./data/claude:/home/claude/.claude:Z
    • ./workspace:/workspace:Z environment:
    • PUID=1000
    • PGID=1000
  3. Run podman compose up -d.

  4. Ask Claude to create or edit a file inside /workspace.

  5. On the host, run ls -ln ./workspace and try to open/edit that file with a normal editor (e.g. VS Code) as the host user (UID 1000).

  6. Run podman top holyclaude user huser to inspect the process UID mapping.

Additional things I tried in isolation, each producing a different failure:

  • Adding :U to the ./workspace mount → container gets write access, but host ownership gets rewritten and I lose host-side write access.

  • Running podman unshare chown -R 1000:1000 ./workspace before startup → results in the host directory being owned by UID 525287 instead of my real host UID 1000, because "1000" inside podman unshare maps through my subuid range.

  • Adding userns_mode: keep-id + user: "1000:1000" to compose → s6-overlay fails to start services:

    runuser: may not be used by non-root users s6-applyuidgid: fatal: unable to set supplementary group list: Operation not permitted

Docker Compose / Run command

# ==============================================================================
# HolyClaude — Quick Start
# Just run: docker compose up -d
# Then open: http://localhost:3001
# ==============================================================================

services:
  holyclaude:
    image: coderluii/holyclaude:latest     # Full image (use :slim for smaller download)
    container_name: holyclaude
    hostname: holyclaude
    restart: unless-stopped
    shm_size: 2g                           # Chromium needs this — don't remove
    network_mode: bridge
    cap_add:
      - SYS_ADMIN                          # Required: Chromium sandboxing
      - SYS_PTRACE                         # Required: debugging tools
    security_opt:
      - seccomp=unconfined                 # Required: Chromium in Docker
    ports:
      - "127.0.0.1:3001:3001"              # CloudCLI web UI, localhost only
    volumes:
      #
      # ./data/claude — Your settings, credentials, API keys, and Claude's memory.
      #                  This is what survives container rebuilds.
      #                  NEVER delete this folder — your auth lives here.
      #
      - ./data/claude:/home/claude/.claude:Z
      #
      # ./workspace — Your code. All projects go here.
      #               Bind-mounted so you can access files from your host.
      #
      - ./workspace:/workspace:Z
    environment:
      - TZ=UTC                             # Your timezone (e.g., America/New_York, Europe/London)
      - PUID=1000
      - PGID=1000

Logs / Error output


SmoothHalo avatar Jul 02 '26 05:07 SmoothHalo

@SmoothHalo thanks for the detailed rootless Podman report. You were right that the old Docker-style PUID/PGID answer was not enough for this case. With rootless Podman, the user namespace mapping is the important part, and :U can make host editing worse by rewriting ownership for the container namespace.

I released v1.4.1 with a rootless Podman path for this:

  • Added docker-compose.podman-rootless.yaml with userns_mode: keep-id, user: "1000:1000", and :Z bind labels.
  • Updated startup so non-root containers skip groupmod, usermod, root-only chown repairs, bubblewrap setuid repair, and the CloudCLI s6-setuidgid drop.
  • CloudCLI now runs directly when the container already starts as UID/GID 1000.
  • Updated README, Docker Hub docs, troubleshooting, configuration, architecture, changelog, memory docs, and translations to explain Docker PUID/PGID versus Podman keep-id.

Use this path for rootless Podman:

mkdir -p data/claude workspace
podman compose -f docker-compose.podman-rootless.yaml up -d

The v1.4.1 release and tag are published now. The Docker publish workflow is still building the multi-arch full/slim images, so if the new Docker Hub or GHCR tags are not visible immediately, give that workflow time to finish before pulling.

I validated the fix with rootless Fedora Podman using both HolyClaude variants: host-created files were readable inside /workspace, container-created files landed back on the host as UID/GID 1000, podman top holyclaude user huser showed the keep-id mapping, CloudCLI responded on port 3001, and CloudCLI/Xvfb ran as claude. The compose file keeps :Z for SELinux hosts and intentionally avoids :U.

Closing this because v1.4.1 now ships the rootless Podman compose profile and the non-root startup path that this issue needed.

CoderLuii avatar Jul 03 '26 00:07 CoderLuii

Thanks, will give some time to let it build, will test it and report results.

SmoothHalo avatar Jul 03 '26 02:07 SmoothHalo

Cam here to say that this worked, though for podman to work then it should be like this:

services:
  holyclaude:
    image: coderluii/holyclaude:latest
    container_name: holyclaude
    hostname: holyclaude
    restart: unless-stopped
    shm_size: 2g
    userns_mode: "keep-id:uid=1000,gid=1000"
    network_mode: bridge
    cap_add:
      - SYS_ADMIN
      - SYS_PTRACE
    security_opt:
      - seccomp=unconfined
    ports:
      - "3001:3001"
    volumes:
      - ./data/claude:/home/claude/.claude:Z
      - ./workspace:/workspace:Z
    environment:
      - TZ=UTC
      - PUID=1000
      - PGID=1000

It's just a minor fix.

SmoothHalo avatar Jul 08 '26 13:07 SmoothHalo

@SmoothHalo thanks for testing it and for the exact Podman shape.

You were right: the rootless compose profile should use Podman's explicit keep-id mapping:

userns_mode: "keep-id:uid=1000,gid=1000"

I released this in v1.4.5 and kept the :Z bind labels without adding :U, so the workspace stays editable from both the host and the container without recursive host ownership rewrites.

Release: https://github.com/CoderLuii/HolyClaude/releases/tag/v1.4.5

CoderLuii avatar Jul 09 '26 05:07 CoderLuii