fix(deploy): pre-create workspace dir with correct ownership for OpenClaw containers

OpenClaw runs as node user (uid 1000) but the host directory was created as root,
causing EACCES when the container tried to create /home/node/.openclaw/workspace.

Now mkdir workspace/ and chown -R 1000:1000 before starting the container.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-08 14:32:50 -07:00
parent 495407d25b
commit a8b5571aea
1 changed files with 3 additions and 0 deletions

View File

@ -212,6 +212,9 @@ export class AgentInstanceDeployService {
});
await this.sshExec(sshCreds, `mkdir -p /data/openclaw/${instance.id}/agents/main/agent && printf '%s' '${authProfiles.replace(/'/g, "'\\''")}' > /data/openclaw/${instance.id}/agents/main/agent/auth-profiles.json`);
// Pre-create workspace dir and fix ownership so the container (running as node uid=1000) can write
await this.sshExec(sshCreds, `mkdir -p /data/openclaw/${instance.id}/workspace && chown -R 1000:1000 /data/openclaw/${instance.id}`);
const cmd = [
'docker run -d',
`--name ${instance.containerName}`,