Skip to content

Deploy builds new image but Swarm service keeps running old image (port already in use) #2150

@tiefectoestrategico

Description

@tiefectoestrategico

To Reproduce

  1. Install Dokploy v0.2.2 on a single-node Swarm VPS (Ubuntu 22.04 x86_64, Docker 26.1.0).
  2. Create a Next.js application (port 3001) named pawify-frontend-ptomtr with the Dockerfile below and deploy it from GitHub via Dokploy GUI/webhook.
  3. Push a change to GitHub, trigger a new Dokploy deploy (build succeeds – “Docker Deployed: ✅”).
  4. Observe that:
    • A new image is built (IMAGE_ID f24b2315f3cd, etc.).
    • Dokploy keeps the old service/container running and does not replace it.
    • Swarm shows multiple failed tasks with error no suitable node (host-mode port already in use on 1 node) and the service remains on the stale image.

Current vs. Expected behavior

Current vs. Expected behaviour

Current:

  • Dokploy finishes the deploy step but the Swarm service still points to the previous image.
  • New images accumulate (docker images shows many <none> dangling layers).
  • Manual intervention ( docker service update --force --image <new> or stopping the service and redeploying) is required every time.

Expected:

  • After each successful build, Dokploy should automatically update the Swarm service to the freshly built :latest (or timestamp/commit-tagged) image without leaving the previous container bound to the port.

Provide environment information

Operating System:  Ubuntu 22.04.4 LTS (x86_64)  
Dokploy version:   0.2.2  
Docker version:    26.1.0  
Swarm mode:        single node (manager)  
VPS Provider:      OVH VPS S 2024  
Applications:      Next.js (20-alpine) frontend on port 3001
                   Laravel + PHP 8.3 backend on port 8001 (works fine)

Which area(s) are affected? (Select all that apply)

Application, Docker

Are you deploying the applications where Dokploy is installed or on a remote server?

Both

Additional context

docker service ps pawify-frontend-ptomtr --no-trunc

p4bd... pawify-frontend-ptomtr.1 pawify-frontend-ptomtr:latest Running Pending "no suitable node (host-mode port already in use on 1 node)"
f4sa... _ pawify-frontend-ptomtr.1 pawify-frontend-ptomtr:latest Running Running 11m *:3001->3001/tcp
...

Output after deploy

#21 naming to docker.io/library/pawify-frontend-ptomtr done
Docker Deployed: ✅

Will you send a PR to fix it?

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions