Skip to content

Dockerode-over-SSH service creation fails, while equivalent manual docker service create works on the same host #4116

@eddiespotfav

Description

@eddiespotfav

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
  • serverId is correctly set at application.create
  • buildServerId is correctly set
  • remote clone works
  • remote .env file creation works
  • remote Docker build works
  • Docker access for the remote user works
  • a Dokploy application port record exists
  • dokploy-network exists 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:

  1. clone the repo to:
    /etc/dokploy/applications/<appName>/code
  2. write the .env
  3. build the image:
    docker build -t <appName>:latest -f Dockerfile .
  4. 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:prod

This 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.ts
  • packages/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 settings object
  • 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 CreateServiceOptions object
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions