Agent Skillssbusso/claudeclaw › convert-to-apple-container

convert-to-apple-container

GitHub

将 macOS 环境下的容器运行时从 Docker 切换至 Apple Container,涉及代码重构、构建脚本更新及验证流程。

skills/convert-to-apple-container/SKILL.md sbusso/claudeclaw

Trigger Scenarios

apple container convert to apple container switch to apple container use apple container

Install

npx skills add sbusso/claudeclaw --skill convert-to-apple-container -g -y
More Options

Use without installing

npx skills use sbusso/claudeclaw@convert-to-apple-container

指定 Agent (Claude Code)

npx skills add sbusso/claudeclaw --skill convert-to-apple-container -a claude-code -g -y

安装 repo 全部 skill

npx skills add sbusso/claudeclaw --all -g -y

预览 repo 内 skill

npx skills add sbusso/claudeclaw --list

SKILL.md

Frontmatter
{
    "name": "convert-to-apple-container",
    "description": "Switch from Docker to Apple Container for macOS-native container isolation. Use when the user wants Apple Container instead of Docker, or is setting up on macOS and prefers the native runtime. Triggers on \"apple container\", \"convert to apple container\", \"switch to apple container\", or \"use apple container\"."
}

Convert to Apple Container

This skill switches ClaudeClaw's container runtime from Docker to Apple Container (macOS-only). It uses the skills engine for deterministic code changes, then walks through verification.

What this changes:

  • Container runtime binary: dockercontainer
  • Mount syntax: -v path:path:ro--mount type=bind,source=...,target=...,readonly
  • Startup check: docker infocontainer system status (with auto-start)
  • Orphan detection: docker ps --filtercontainer ls --format json
  • Build script default: dockercontainer
  • Dockerfile entrypoint: .env shadowing via mount --bind inside the container (Apple Container only supports directory mounts, not file mounts like Docker's /dev/null overlay)
  • Container runner: main-group containers start as root for mount --bind, then drop privileges via setpriv

What stays the same:

  • Mount security/allowlist validation
  • All exported interfaces and IPC protocol
  • Non-main container behavior (still uses --user flag)
  • All other functionality

Prerequisites

Verify Apple Container is installed:

container --version && echo "Apple Container ready" || echo "Install Apple Container first"

If not installed:

Apple Container requires macOS. It does not work on Linux.

Phase 1: Pre-flight

Check if already applied

grep "CONTAINER_RUNTIME_BIN" src/orchestrator/container-runtime.ts

If it already shows 'container', the runtime is already Apple Container. Skip to Phase 3.

Phase 2: Apply Code Changes

Ensure upstream remote

git remote -v

If upstream is missing, add it:

git remote add upstream https://github.com/sbusso/claudeclaw.git

Merge the skill branch

git fetch upstream skill/apple-container
git merge upstream/skill/apple-container

This merges in:

  • src/orchestrator/container-runtime.ts — Apple Container implementation (replaces Docker)
  • src/container-runtime.test.ts — Apple Container-specific tests
  • src/orchestrator/container-runner.ts — .env shadow mount fix and privilege dropping
  • src/runtimes/docker/Dockerfile — entrypoint that shadows .env via mount --bind
  • src/runtimes/docker/build.sh — default runtime set to container

If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.

Validate code changes

npm test
npm run build

All tests must pass and build must be clean before proceeding.

Phase 3: Verify

Ensure Apple Container runtime is running

container system status || container system start

Build the container image

./src/runtimes/docker/build.sh

Test basic execution

echo '{}' | container run -i --entrypoint /bin/echo claudeclaw-agent:latest "Container OK"

Test readonly mounts

mkdir -p /tmp/test-ro && echo "test" > /tmp/test-ro/file.txt
container run --rm --entrypoint /bin/bash \
  --mount type=bind,source=/tmp/test-ro,target=/test,readonly \
  claudeclaw-agent:latest \
  -c "cat /test/file.txt && touch /test/new.txt 2>&1 || echo 'Write blocked (expected)'"
rm -rf /tmp/test-ro

Expected: Read succeeds, write fails with "Read-only file system".

Test read-write mounts

mkdir -p /tmp/test-rw
container run --rm --entrypoint /bin/bash \
  -v /tmp/test-rw:/test \
  claudeclaw-agent:latest \
  -c "echo 'test write' > /test/new.txt && cat /test/new.txt"
cat /tmp/test-rw/new.txt && rm -rf /tmp/test-rw

Expected: Both operations succeed.

Service name: Derived from the directory name: com.claudeclaw.<dirname> (macOS) / claudeclaw-<dirname> (Linux). For example, if cwd is my-assistant, the service is com.claudeclaw.my-assistant. Determine the correct service name before running service commands below.

Full integration test

npm run build
launchctl kickstart -k gui/$(id -u)/com.claudeclaw

Send a message via WhatsApp and verify the agent responds.

Troubleshooting

Apple Container not found:

Runtime won't start:

container system start
container system status

Image build fails:

# Clean rebuild — Apple Container caches aggressively
container builder stop && container builder rm && container builder start
./src/runtimes/docker/build.sh

Container can't write to mounted directories: Check directory permissions on the host. The container runs as uid 1000.

Summary of Changed Files

File Type of Change
src/orchestrator/container-runtime.ts Full replacement — Docker → Apple Container API
src/container-runtime.test.ts Full replacement — tests for Apple Container behavior
src/orchestrator/container-runner.ts .env shadow mount removed, main containers start as root with privilege drop
src/runtimes/docker/Dockerfile Entrypoint: mount --bind for .env shadowing, setpriv privilege drop
src/runtimes/docker/build.sh Default runtime: dockercontainer

Version History

  • 1395af4 Current 2026-07-25 07:02

Same Skill Collection

agent/skills/agent-browser/SKILL.md
skills/add-compact/SKILL.md
skills/add-discord/SKILL.md
skills/add-gmail/SKILL.md
skills/add-image-vision/SKILL.md
skills/add-ollama-tool/SKILL.md
skills/add-pdf-reader/SKILL.md
skills/add-qmd/SKILL.md
skills/add-reactions/SKILL.md
skills/add-telegram-swarm/SKILL.md
skills/add-telegram/SKILL.md
skills/add-voice-transcription/SKILL.md
skills/add-whatsapp/SKILL.md
skills/customize/SKILL.md
skills/debug/SKILL.md
skills/get-qodo-rules/SKILL.md
skills/install-extension/SKILL.md
skills/qodo-pr-resolver/SKILL.md
skills/setup/SKILL.md
skills/uninstall/SKILL.md
skills/update-claudeclaw/SKILL.md
skills/update-skills/SKILL.md
skills/use-local-whisper/SKILL.md
skills/x-integration/SKILL.md
skills/uninstall-extension/SKILL.md

Metadata

Files
0
Version
1395af4
Hash
47c4999b
Indexed
2026-07-25 07:02

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 04:12
浙ICP备14020137号-1 $mapa de visitantes$