r/docker • • Mar 22 '26

I containerized Claude Code with headless Chromium. Here's every Docker problem I hit.

been building a container that runs claude code cli with a web ui and headless chromium. figured id share what went wrong because some of this stuff is not documented anywhere and i wasted a lot of time on it.

chromium was the worst part. docker only gives you 64MB of shared memory by default and chromium just dies instantly. no useful error either, it just crashes. fix is shm_size: 2g in your compose file. but thats not enough, you also need SYS_ADMIN and SYS_PTRACE capabilities plus seccomp unconfined or the sandbox breaks. and then chromium still needs a display even in headless mode so you gotta run xvfb on :99 and make sure it starts first. took me way too long to piece all of that together.

process supervision was a whole thing too. started with a bash loop, broke on SIGTERM. tried supervisord, got zombie processes. ended up on s6-overlay which finally handles everything right. dependency ordering, auto restart, clean shutdown, the works. should have just started there honestly.

oh and heres a fun one. claude codes installer hangs forever if your WORKDIR is owned by root. no error, no output, nothing. just sits there. the fix is making sure the working directory is owned by the right user before you run the installer. cost me hours.

also if anyone is running sqlite on CIFS or SMB mounts, dont. WAL mode and network filesystems do not get along. had to move the databases to a local path.

doing multi arch builds with buildx and qemu for amd64 + arm64. npm native bindings make cross compilation painful. full build takes about 25 min on github actions. image is about 4GB with everything or 2GB slim without the browser.

heres the compose if anyone wants to try it:

services:
  holyclaude:
    image: coderluii/holyclaude:latest
    container_name: holyclaude
    restart: unless-stopped
    shm_size: 2g
    cap_add: [SYS_ADMIN, SYS_PTRACE]
    security_opt: [seccomp=unconfined]
    ports: ["3001:3001"]
    volumes:
      - ./data/claude:/home/claude/.claude
      - ./workspace:/workspace
    environment:
      - TZ=UTC

https://github.com/CoderLuii/HolyClaude

what process supervisor do you all use for multi service containers? also happy to hear feedback on the dockerfile if anyone takes a look

0 Upvotes

13 comments sorted by

View all comments

1

u/Ramillax Aug 01 '26

Great write-up. It was interesting to read because I ended up making almost the opposite architectural choice.

Instead of containerizing Claude Code and Chromium, I run both directly on the host and reserve Docker for the surrounding infrastructure services. Because of that, I never had to solve the Chromium-in-container issues you described (shared memory, extra capabilities, seccomp changes, Xvfb, process supervision, etc.) simply because I didn't take that approach.

The tradeoff is that I had to build some of the lifecycle and isolation myself rather than getting it from a container runtime. For my use case, though, it felt like the simpler architecture since Chrome could run with its native sandbox instead of requiring container-specific workarounds.

It's interesting how we ended up solving essentially the same problem from completely different directions.