From 8f068817ca443b7ea2c3a7ae0fdb46c3bd35673c Mon Sep 17 00:00:00 2001 From: {Suksham-sharma} Date: Wed, 28 Jan 2026 23:41:03 +0530 Subject: [PATCH 1/2] fix(docker): add MOLTBOT_STATE_DIR to resolve permission error When running in Docker, the app fell back to os.homedir() to resolve the state directory, but the container's HOME=/home/node didn't match the mounted volume permissions properly. By explicitly setting MOLTBOT_STATE_DIR=/home/node/.clawdbot in the container environment, the app now correctly uses the mounted volume path, fixing the "EACCES: permission denied, mkdir '/home/node/.clawdbot/agents/main/agent'" error. Fixes #3480 --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 8ce610d6a..256852965 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ services: image: ${CLAWDBOT_IMAGE:-moltbot:local} environment: HOME: /home/node + MOLTBOT_STATE_DIR: /home/node/.clawdbot TERM: xterm-256color CLAWDBOT_GATEWAY_TOKEN: ${CLAWDBOT_GATEWAY_TOKEN} CLAUDE_AI_SESSION_KEY: ${CLAUDE_AI_SESSION_KEY} @@ -31,6 +32,7 @@ services: image: ${CLAWDBOT_IMAGE:-moltbot:local} environment: HOME: /home/node + MOLTBOT_STATE_DIR: /home/node/.clawdbot TERM: xterm-256color BROWSER: echo CLAUDE_AI_SESSION_KEY: ${CLAUDE_AI_SESSION_KEY} From 7e47d8d9fab6818e05fabd17b4b5eeacca99493f Mon Sep 17 00:00:00 2001 From: {Suksham-sharma} Date: Thu, 29 Jan 2026 01:33:31 +0530 Subject: [PATCH 2/2] fix(docker): set directory ownership for container user Add chown commands to set ownership of mounted directories to uid 1000 (the container's node user). This allows the container to write to the mounted volumes when the host directories are owned by root. Uses || true to avoid failing when run by non-root users. --- docker-setup.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-setup.sh b/docker-setup.sh index 0f7571e96..d56b24177 100755 --- a/docker-setup.sh +++ b/docker-setup.sh @@ -26,6 +26,10 @@ mkdir -p "${CLAWDBOT_WORKSPACE_DIR:-$HOME/clawd}" export CLAWDBOT_CONFIG_DIR="${CLAWDBOT_CONFIG_DIR:-$HOME/.clawdbot}" export CLAWDBOT_WORKSPACE_DIR="${CLAWDBOT_WORKSPACE_DIR:-$HOME/clawd}" + +# Set ownership to container user (uid 1000) so the container can write to mounted volumes +chown -R 1000:1000 "$CLAWDBOT_CONFIG_DIR" 2>/dev/null || true +chown -R 1000:1000 "$CLAWDBOT_WORKSPACE_DIR" 2>/dev/null || true export CLAWDBOT_GATEWAY_PORT="${CLAWDBOT_GATEWAY_PORT:-18789}" export CLAWDBOT_BRIDGE_PORT="${CLAWDBOT_BRIDGE_PORT:-18790}" export CLAWDBOT_GATEWAY_BIND="${CLAWDBOT_GATEWAY_BIND:-lan}"