Skip to content

[Bug] Traefik (and dokploy) fails to start when port 8080 is already in use (Service Crash) #3806

@zengdard

Description

@zengdard

To Reproduce

Have a service (in my case, CrowdSec) already listening on port 8080 (on 127.0.0.1:8080).
Go to the Dokploy Dashboard.
Navigate to Settings > Traefik.
Click to Install or Enable Traefik.
Observe the error in the logs or the UI behavior.

Current vs. Expected behavior

  • Current behavior: When trying to enable Traefik, Docker throws a 500 error: Error: (HTTP code 500) server error - failed to set up container networking: ... failed to bind host port for 0.0.0.0:8080: ... address already in use

  • The Traefik container fails to start or restarts in a loop. The Dokploy logs show repeated "ExecError" messages related to the port binding failure.
    Expected behavior: Dokploy should check if the required ports (specifically 8080 for the dashboard) are available before attempting to create the service. If the port is busy, it should display a clear user-friendly error message in the UI (e.g., "Port 8080 is already in use by [Service Name]. Please stop the service or change the Traefik configuration") instead of crashing or failing silently in the background.

Provide environment information

Operating System: Ubuntu 22.04 LTS ( (Vérifie avec lsb_release -a si ce n'est pas ça) )
Dokploy version: v0.27.1
VPS Provider: Hetzner (Cloud CX41 / 4GB)
What applications/services are you trying to deploy? Dokploy, Traefik, CrowdSec (Conflicting service).

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

Application

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

Same server where Dokploy is installed

Additional context

I tested on a Hetzner Cloud VPS (Ubuntu).
The issue occurred because crowdsec was listening on 127.0.0.1:8080. Even though it was bound to localhost, Traefik (trying to bind 0.0.0.0:8080) failed.
Logs snippet:

Error [ExecError]: Command execution failed: Command failed: ...
Traefik Not Found: Starting Error: (HTTP code 500) server error - failed to set up container networking: ... failed to bind host port for 0.0.0.0:8080:172.21.0.10:8080/tcp: address already in use
Workaround: I had to manually stop the conflicting service (systemctl stop crowdsec), let Dokploy start Traefik, and then reconfigure the port mapping via CLI to free up port 8080 again.

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