Sandbox CLI
격리된 에이전트 실행을 위한 Docker 기반 샌드박스 컨테이너를 관리합니다.
개요
OpenClaw는 보안을 위해 격리된 Docker 컨테이너에서 에이전트를 실행할 수 있습니다. sandbox 명령을 사용하면 특히 업데이트나 구성 변경 후 이러한 컨테이너를 관리할 수 있습니다.
명령어
openclaw sandbox explain
적용된 샌드박스 모드/범위/작업 공간 접근, 샌드박스 도구 정책, 그리고 승격 게이트를 확인합니다 (수정 설정 키 경로 포함).
openclaw sandbox explain
openclaw sandbox explain --session agent:main:main
openclaw sandbox explain --agent work
openclaw sandbox explain --json
openclaw sandbox list
모든 샌드박스 컨테이너의 상태와 구성을 나열합니다.
openclaw sandbox list
openclaw sandbox list --browser # 브라우저 컨테이너만 나열
openclaw sandbox list --json # JSON 출력
출력 내용:
- 컨테이너 이름 및 상태 (실행 중/중지됨)
- Docker 이미지 및 설정 일치 여부
- 경과 시간 (생성 이후)
- 유휴 시간 (마지막 사용 이후)
- 연결된 세션/에이전트
openclaw sandbox recreate
업데이트된 이미지/설정으로 재생성을 강제하기 위해 샌드박스 컨테이너를 제거합니다.
openclaw sandbox recreate --all # 모든 컨테이너 재생성
openclaw sandbox recreate --session main # 특정 세션
openclaw sandbox recreate --agent mybot # 특정 에이전트
openclaw sandbox recreate --browser # 브라우저 컨테이너만
openclaw sandbox recreate --all --force # 확인 건너뛰기
옵션:
--all: 모든 샌드박스 컨테이너 재생성--session <key>: 특정 세션의 컨테이너 재생성--agent <id>: 특정 에이전트의 컨테이너 재생성--browser: 브라우저 컨테이너만 재생성--force: 확인 프롬프트 건너뛰기
중요: 컨테이너는 에이전트가 다음에 사용될 때 자동으로 재생성됩니다.
사용 사례
Docker 이미지 업데이트 후
# 새 이미지 풀
docker pull openclaw-sandbox:latest
docker tag openclaw-sandbox:latest openclaw-sandbox:bookworm-slim
# 새 이미지를 사용하도록 설정 업데이트
# 설정 편집: agents.defaults.sandbox.docker.image (또는 agents.list[].sandbox.docker.image)
# 컨테이너 재생성
openclaw sandbox recreate --all
샌드박스 구성 변경 후
# 설정 편집: agents.defaults.sandbox.* (또는 agents.list[].sandbox.*)
# 새 설정 적용을 위해 재생성
openclaw sandbox recreate --all
setupCommand 변경 후
openclaw sandbox recreate --all
# 또는 특정 에이전트만:
openclaw sandbox recreate --agent family
특정 에이전트만
# 특정 에이전트의 컨테이너만 업데이트
openclaw sandbox recreate --agent alfred
이 기능이 필요한 이유
문제: 샌드박스 Docker 이미지나 구성을 업데이트할 때:
- 기존 컨테이너는 이전 설정으로 계속 실행됩니다
- 컨테이너는 24시간 비활성 후에만 정리됩니다
- 자주 사용되는 에이전트는 이전 컨테이너를 무기한으로 유지합니다
해결: openclaw sandbox recreate를 사용하여 이전 컨테이너를 강제로 제거합니다. 다음에 필요할 때 현재 설정으로 자동으로 재생성됩니다.
팁: 수동 docker rm보다 openclaw sandbox recreate를 사용하세요. 게이트웨이의 컨테이너 네이밍을 사용하여 범위/세션 키 변경 시 불일치를 방지합니다.
구성
샌드박스 설정은 ~/.openclaw/openclaw.json의 agents.defaults.sandbox에 있습니다 (에이전트별 재정의는 agents.list[].sandbox):
{
"agents": {
"defaults": {
"sandbox": {
"mode": "all", // off, non-main, all
"scope": "agent", // session, agent, shared
"docker": {
"image": "openclaw-sandbox:bookworm-slim",
"containerPrefix": "openclaw-sbx-",
// ... 추가 Docker 옵션
},
"prune": {
"idleHours": 24, // 24시간 유휴 후 자동 정리
"maxAgeDays": 7, // 7일 후 자동 정리
},
},
},
},
}
관련 문서
- Sandbox Documentation
- Agent Configuration
- Doctor Command - 샌드박스 설정 확인