convert-to-apple-container
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".
- License 许可
- MIT
- 所属仓库
- mbaker95/nanodex
- 最近更新
- 2026-03-12
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- 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".
02 资源文件 11
- 参考文档api-style.md1.1 KB
- 参考文档auth.md576 B
- 参考文档documentation.md549 B
- 参考文档graphql.md977 B
- 参考文档rate-limiting.md726 B
- 参考文档response.md921 B
- 参考文档rest.md1.3 KB
- 脚本scripts/api_validator.py7.4 KB
- 参考文档security-testing.md2.8 KB
- 参考文档trpc.md801 B
- 参考文档versioning.md651 B
03 SKILL.md 正文
Convert to Apple Container
This skill switches NanoDex'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:
docker→container - Mount syntax:
-v path:path:ro→--mount type=bind,source=...,target=...,readonly - Startup check:
docker info→container system status(with auto-start) - Orphan detection:
docker ps --filter→container ls --format json - Build script default:
docker→container - Dockerfile entrypoint:
.envshadowing viamount --bindinside the container (Apple Container only supports directory mounts, not file mounts like Docker's/dev/nulloverlay) - Container runner: main-group containers start as root for
mount --bind, then drop privileges viasetpriv
What stays the same:
- Mount security/allowlist validation
- All exported interfaces and IPC protocol
- Non-main container behavior (still uses
--userflag) - All other functionality
Prerequisites
Verify Apple Container is installed:
container --version && echo "Apple Container ready" || echo "Install Apple Container first"
If not installed:
- Download from https://github.com/apple/container/releases
- Install the
.pkgfile - Verify:
container --version
Apple Container requires macOS. It does not work on Linux.
Phase 1: Pre-flight
Check if already applied
grep "CONTAINER_RUNTIME_BIN" src/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/qwibitai/nanoclaw.git
Merge the skill branch
git fetch upstream skill/apple-container
git merge upstream/skill/apple-container
This merges in:
src/container-runtime.ts— Apple Container implementation (replaces Docker)src/container-runtime.test.ts— Apple Container-specific testssrc/container-runner.ts— .env shadow mount fix and privilege droppingcontainer/Dockerfile— entrypoint that shadows .env viamount --bindcontainer/build.sh— default runtime set tocontainer
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
./container/build.sh
Test basic execution
echo '{}' | container run -i --entrypoint /bin/echo nanodex-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 \
nanodex-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 \
nanodex-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.
Full integration test
npm run build
launchctl kickstart -k gui/$(id -u)/com.nanodex
Send a message via WhatsApp and verify the agent responds.
Troubleshooting
Apple Container not found:
- Download from https://github.com/apple/container/releases
- Install the
.pkgfile - Verify:
container --version
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
./container/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/container-runtime.ts |
Full replacement — Docker → Apple Container API |
src/container-runtime.test.ts |
Full replacement — tests for Apple Container behavior |
src/container-runner.ts |
.env shadow mount removed, main containers start as root with privilege drop |
container/Dockerfile |
Entrypoint: mount --bind for .env shadowing, setpriv privilege drop |
container/build.sh |
Default runtime: docker → container |
04 同仓库更多 Skills
agent-browser
Browse the web for any task — research topics, read articles, interact with web apps, fill forms, take screenshots, extract data, and test web pages. Use whenever a browser would be useful, not just when the user explicitly asks.
x-integration
X (Twitter) integration for NanoClaw. Post tweets, like, reply, retweet, and quote. Use for setup, testing, or troubleshooting X functionality. Triggers on "setup x", "x integration", "twitter", "post tweet", "tweet".
use-local-whisper
Use when the user wants local voice transcription instead of OpenAI Whisper API. Switches to whisper.cpp running on Apple Silicon. WhatsApp only for now. Requires voice-transcription skill to be applied first.
update-skills
Check for and apply updates to installed skill branches from upstream.
update-nanoclaw
Efficiently bring upstream NanoClaw updates into a customized install, with preview, selective cherry-pick, and low token usage.
setup
Run initial NanoClaw setup. Use when user wants to install dependencies, authenticate messaging channels, register their main channel, or start the background services. Triggers on "setup", "install", "configure nanoclaw", or first-time setup requests.