Claude Code Apple Devcontainer

Introduction

I was recently inspired to test two open source projects from Trail of Bits:

Both projects are very interesting and they incorporate many other open source projects. I was already using Claude Code on my macOS host. Applying the claude-code-config wasn't bad given the nice README and instructions. But trying the corresponding devcontainer was a bit more of a challenge since I'm using Apple's container implementation for Mac (0.9.0 on macOS 26.3) instead of Docker and I'm using Neovim and terminal instead of VS Code.

The work on this page tries to get the spirit of claude-code-devcontainer working with Apple's container implementation. More work would be required to get things perfect and to replicate all of the devc features. But the basics are working well for me.

I have a Claude subscription plan, so I couldn't pass in an API key. I had to login with Claude in a test container, capture the ~/.claude.json file, and then replicate that in my dev containers.

~/.claude/claude.json.adevc

Capture or provide your own .claude.json file with authentication and session information.

zshrc-adevc

Copy this file into the claude-devcontainer directory prior to building the container.


# Make sure claude login session is copied in properly
cp ~/.claude/claude.json.adevc ~/.claude.json

# Run the post install script
uv run --no-project /opt/post_install.py
    

Dockerfile.patch

Copy this file into the claude-devcontainer directory prior to building the container. Run 'patch < Dockerfile.patch' to update the Dockerfile.


diff --git a/Dockerfile b/Dockerfile
index d83aaf0..6c8c804 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -102,9 +102,11 @@ RUN sh -c "$(curl -fsSL https://github.com/deluan/zsh-in-docker/releases/downloa
 
 # Copy zsh configuration
 COPY --chown=vscode:vscode .zshrc /home/vscode/.zshrc.custom
+COPY --chown=vscode:vscode zshrc-adevc /home/vscode/.zshrc.adevc
 
 # Append custom zshrc to the main one
 RUN echo 'source ~/.zshrc.custom' >> /home/vscode/.zshrc
+RUN echo 'source ~/.zshrc.adevc' >> /home/vscode/.zshrc
 
 # Copy post_install script
 COPY --chown=vscode:vscode post_install.py /opt/post_install.py
    

build-adevc.sh

Run this in the claude-devcontainer directory.


#!/bin/bash

container build -t claude-devcontainer -c 4 -m 8G
    

adevc.sh

Run this in the working directory you want to use Claude Code in.


#!/bin/bash

container run -it --rm \
--mount "source=.,target=/workspace" \
--mount "source=~/.claude,target=/home/vscode/.claude" \
--cpus 4 \
--memory 4G \
claude-devcontainer zsh