Convert to apple container

From sliamh11/Deus · View interactive version

Convert to apple container is an AI agent skill from the GitHub repository sliamh11/Deus. 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 con

How to use this skill

Skill file

Convert to Apple Container

This skill switches Deus'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:

stops containers whose name ends in this install's -i<8hex> stamp; names

without a stamp are warned about, never stopped. Dropping that partition

during the port silently restores the old host-wide sweep, in which a second

daemon kills the first's live containers. The stamp is a plain name suffix,

so it survives any listing format — only the parsing needs porting.

What stays the same:

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/container-runtime.ts

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

Phase 2: Apply Code Changes

Check if the Apple Container runtime files are already present:

grep "CONTAINER_RUNTIME_BIN" src/container-runtime.ts

If it already shows 'container', the runtime is already Apple Container. If not, the following files need to be updated:

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 deus-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 \
  deus-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 \
  deus-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.deus

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
./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 |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.