Skip to content

Commit 6ef4334

Browse files
committed
fix docker in docker
1 parent 125467d commit 6ef4334

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

crates/example-eventage-claw/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ RUN apk add --no-cache ca-certificates chromium docker-cli
3131

3232
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/claw /usr/local/bin/claw
3333

34-
# Persistent data directory: config, skills, memory, tasks, event log.
35-
VOLUME ["/root/.claw"]
34+
# Data directory — overridden at runtime via CLAW_DATA_DIR env var.
35+
# The default path must match the bind-mount in docker-compose.yml.
36+
ENV CLAW_DATA_DIR=/opt/claw/data
37+
RUN mkdir -p /opt/claw/data
3638

3739
EXPOSE 3000
3840

crates/example-eventage-claw/docker-compose.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ services:
1111
ports:
1212
- "3000:3000"
1313
volumes:
14-
# Persistent data: skills/, memory/, tasks.json, events.jsonl
15-
- claw-data:/root/.claw
14+
# Bind-mount at the SAME path on host and container so that when
15+
# run_in_docker passes this path to the host Docker daemon the bind
16+
# mount resolves correctly (named volumes don't work for DinD).
17+
- ${CLAW_DATA_DIR:-/opt/claw/data}:${CLAW_DATA_DIR:-/opt/claw/data}
1618
# Docker socket — required for run_in_docker tool (docker_enabled in config)
1719
- /var/run/docker.sock:/var/run/docker.sock
1820
environment:
@@ -22,6 +24,8 @@ services:
2224
- LLM_URL
2325
- LLM_MODEL
2426
- CLAW_GROUPS # e.g. "personal,alice,bob"
27+
# Must match the bind-mount path above so claw uses the correct data dir.
28+
- CLAW_DATA_DIR=${CLAW_DATA_DIR:-/opt/claw/data}
2529

2630
# ── WhatsApp bridge (Node.js, Baileys) ────────────────────────────────────
2731
whatsapp-bridge:
@@ -34,7 +38,7 @@ services:
3438
- "3001:3001"
3539
volumes:
3640
- ${BRIDGE_AUTH_DIR:-/opt/claw/bridge-auth}:/app/auth
37-
- claw-data:/root/.claw # shared with claw so bridge-downloaded media is accessible to agent
41+
- ${CLAW_DATA_DIR:-/opt/claw/data}:/root/.claw # shared with claw so bridge-downloaded media is accessible to agent
3842
environment:
3943
CLAW_HTTP_URL: http://claw:3000
4044
CLAW_GROUP: ${CLAW_GROUP:-personal}
@@ -47,5 +51,3 @@ services:
4751
depends_on:
4852
- claw
4953

50-
volumes:
51-
claw-data: # named volume — survives container restarts, no host path needed

crates/example-eventage-claw/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ fn default_model() -> String {
132132
std::env::var("LLM_MODEL").unwrap_or_else(|_| "qwen3:4b".into())
133133
}
134134
fn default_data_dir() -> PathBuf {
135+
if let Ok(dir) = std::env::var("CLAW_DATA_DIR") {
136+
return PathBuf::from(dir);
137+
}
135138
dirs::home_dir()
136139
.unwrap_or_else(|| PathBuf::from("."))
137140
.join(".claw")

0 commit comments

Comments
 (0)