| name | convert-to-docker |
| command | /convert-to-docker |
| description | Switch container runtime to Docker for isolated execution |
| requiredTools | ["run_code","write_file","read_file"] |
| platforms | ["linux","macos","windows"] |
| version | 1.0.0 |
| author | betaclaw |
betaclaw Convert to Docker Skill
You are the Docker conversion assistant. Convert the current betaclaw execution environment from its current container runtime (Apple Container, Podman, nsjail, chroot, or none) to Docker.
Step 1: Check Current State
- Read
.beta/config.toon to determine the current execution mode and container runtime.
- If already using Docker, inform the user and offer to reconfigure Docker settings instead.
- If in Full Control mode (no containers), warn that switching to Isolated mode with Docker will restrict agent capabilities to container-only execution.
Step 2: Verify Docker Installation
- Run
docker --version to check if Docker is installed.
- If not installed, guide the user through installation:
- Run
docker info to verify Docker daemon is running.
- Run
docker run --rm hello-world to verify Docker can pull and run containers.
Step 3: Create betaclaw Docker Image
Create a Dockerfile.agent in the project root for the agent execution environment:
FROM node:20-slim
WORKDIR /workspace
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl python3 && rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash agent
USER agent
Build the image: docker build -f Dockerfile.agent -t betaclaw-agent:latest .
Step 4: Configure Sandbox
Update src/execution/sandbox.ts configuration to use Docker:
- Set container runtime to
docker in .beta/config.toon.
- Configure default container settings:
- No privileged mode
- User namespace remapping enabled
- Network: outbound only to allowlisted hosts
- Memory limit based on resource profile
- CPU limit based on resource profile
- Auto-remove containers after execution (
--rm)
- Configure mount points from the group's CLAUDE.md
@mounts block.
Step 5: Docker Security Hardening
Apply Docker security best practices:
- Docker socket permissions — restrict to the
docker group only.
- Enable user namespace remapping in
/etc/docker/daemon.json:
{ "userns-remap": "default" }
- No
--privileged flag on any container.
- Read-only root filesystem where possible (
--read-only).
- Drop all capabilities except those explicitly needed (
--cap-drop ALL --cap-add ...).
Step 6: Test Execution
- Run a simple command inside the Docker container:
echo "Hello from Docker".
- Verify file mount works: write a test file from inside the container to a mounted path, read it from the host.
- Verify network restrictions: attempt to reach an allowlisted host (should succeed) and a non-allowlisted host (should fail).
Step 7: Update Configuration
- Update
.beta/config.toon:
- Set
executionMode:isolated
- Set container runtime to
docker
- Restart the orchestrator to pick up the new configuration.
Step 8: Confirm
Report to the user:
- Docker is now the execution runtime
- Container image built and tested
- Security hardening applied
- All agent code execution will run inside ephemeral Docker containers
- Use
/customize to adjust container settings like mounted directories or network rules