-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Dockerode-over-SSH service creation fails, while equivalent manual docker service create works on the same host #4116
Description
Summary
I am using Dokploy programmatically from OpenClaw to deploy an application on the same machine where Dokploy is running.
After debugging several earlier issues (server binding, SSH reachability, serverId persistence, permissions, Docker access), I isolated a new problem:
- Dokploy's deployment flow still fails with:
Remote command failed with exit code 1
- but the equivalent manual Docker Swarm service creation works on the same host, with the same image, port, env vars, and network.
This suggests the issue is now specifically in Dokploy's Dockerode-over-SSH service creation path, not in the application itself.
Context
I already validated all of the following:
- SSH connectivity from Dokploy to the target host works
- host uses real LAN IP instead of
127.0.0.1 serverIdis correctly set atapplication.createbuildServerIdis correctly set- remote clone works
- remote
.envfile creation works - remote Docker build works
- Docker access for the remote user works
- a Dokploy application port record exists
dokploy-networkexists on the host
So the app/runtime is valid and deployable.
What fails in Dokploy
Dokploy deployment still ends with:
An error have occured: Remote command failed with exit code 1
The deployment record has no useful log path/body in this failure mode.
What works manually
On the same host, I can manually do the following successfully:
- clone the repo to:
/etc/dokploy/applications/<appName>/code - write the
.env - build the image:
docker build -t <appName>:latest -f Dockerfile . - create the Swarm service manually:
docker service create \
--name <appName> \
--network dokploy-network \
--publish published=3001,target=3001,protocol=tcp,mode=host \
--env AUTH_SECRET=... \
--env DATABASE_URL=file:/data/mydestinations.db \
--env NODE_ENV=development \
--env HOSTNAME=0.0.0.0 \
--env PORT=3001 \
--env NEXT_TELEMETRY_DISABLED=1 \
<appName>:latest \
npm run start:prodThis converges successfully, opens port 3001, and the app responds with HTTP 200 on:
//login/setup
Why I think the bug is in Dokploy
From the source:
- build happens via remote shell command
- service creation happens later via Dockerode-over-SSH:
getRemoteDocker(application.serverId)docker.createService(settings)
Relevant files:
packages/server/src/utils/builders/index.tspackages/server/src/utils/servers/remote-docker.ts
The same service configuration appears to work manually, so the remaining problem seems specific to:
- how Dokploy builds the
settingsobject - or how Dockerode-over-SSH is executing
createService(settings)in this environment
Evidence gathered
Working manually
- remote git clone: OK
- remote env file write: OK
- remote docker build: OK
- manual swarm service create: OK
- service converges: OK
- app reachable on published port: OK
Failing in Dokploy
- deployment status:
error - message:
Remote command failed with exit code 1 - no useful deployment log body for this stage
Suspected area
The issue is likely in one of these:
- Dockerode-over-SSH service creation
- generated
CreateServiceOptionsobject - mismatch between Dokploy-generated service spec and the working manual
docker service create - swallowed Dockerode error before it is logged back into deployment logs
Environment
- Dokploy public repo
- investigated against source commit:
290a03c
- automation/orchestration client:
- OpenClaw
- deployment target:
- same host where Dokploy is installed