Skip to content

fix: keep all additional traefik port bindings sharing one target port - #5559

Open
Tyagiquamar wants to merge 1 commit into
Dokploy:canaryfrom
Tyagiquamar:fix/5509-port-mapping-overwrite
Open

Tyagiquamar wants to merge 1 commit into
Dokploy:canaryfrom
Tyagiquamar:fix/5509-port-mapping-overwrite

Conversation

@Tyagiquamar

@Tyagiquamar Tyagiquamar commented Oct 1, 2026 •

Copy link
Copy Markdown

Standalone traefik setup keyed PortBindings by targetPort/protocol and replaced the entry on each iteration, so when two additional port mappings shared a targetPort only the last published port survived on dokploy-traefik.

Appends to the existing entry instead, matching Docker's PortBindings model (one key, array of HostPort entries). The Swarm path already uses a flat array and is unaffected.

Fixes #5509

Validation:

  • New scoped test apps/dokploy/test/traefik/standalone-port-bindings.test.ts: 3 passed (fails on pre-fix code).
  • pnpm --filter=@dokploy/server run typecheck: clean.
  • biome check on touched files: clean (one pre-existing info on an untouched line).
  • Neighboring traefik suite: 56/57 pass; the single failure is a pre-existing Windows-only issue in write-app-traefik-config.test.ts (rm -f with quoted Windows path, untouched module).

RetriggerConfidence Score: 4/5

This PR is not safe to merge until standalone dashboard setup avoids the duplicate 8080 binding.

Summary

Standalone Traefik now keeps every published port that shares a target port and protocol, matching Docker’s list-based binding format.

  • The setup appends each published port instead of replacing earlier bindings.
  • New tests cover shared targets, separate protocols, and existing bindings.

Reviews (1) · Last reviewed commit: "fix: keep all additional traefik port bi..."

 Standalone traefik setup keyed PortBindings by targetPort/protocol and
 replaced the entry on each iteration, so only the last published port
 survived. Append to the existing entry instead.

 Fixes Dokploy#5509
Comment on lines +46 to +48
portBindings[portKey].push({
HostPort: port.publishedPort.toString(),
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Dashboard binds port 8080 twice

When an admin enables the dashboard on standalone Traefik, setup adds an 8080/tcp binding before applyAdditionalPortBindings appends the same host port again. Docker receives two requests to bind port 8080, which can stop Traefik from starting. Keep distinct published ports, but skip a binding that already exists.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Additional Port Mappings: two entries sharing the same targetPort silently overwrite each other (last one wins)

1 participant