Fix: Add traefik.docker.network label to prevent routing to wrong network#8975
Open
dlaporte wants to merge 1 commit intocoollabsio:nextfrom
Open
Fix: Add traefik.docker.network label to prevent routing to wrong network#8975dlaporte wants to merge 1 commit intocoollabsio:nextfrom
dlaporte wants to merge 1 commit intocoollabsio:nextfrom
Conversation
…work When a container is on multiple Docker networks, Traefik non-deterministically picks which network IP to route to. This adds the traefik.docker.network label mirroring the existing Caddy caddy_ingress_network pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
When a Docker Compose app has multiple networks (e.g., an
internal: truenetwork for service isolation), Traefik randomly picks which network IP to
route to because Go map iteration is non-deterministic. If it picks an
unreachable network, requests hang.
fqdnLabelsForCaddy()already handles this by emittingcaddy_ingress_network,but
fqdnLabelsForTraefik()never emitted the equivalenttraefik.docker.networklabel. This PR adds it, following the same pattern: use
$uuidfor DockerCompose deployments (where
$serviceLabelsis set), and$networkforsingle-container apps.
Three files changed:
bootstrap/helpers/docker.php— added?string $network = nullparameterand label emission to
fqdnLabelsForTraefik()bootstrap/helpers/parsers.php— pass$networkto all 4 call sitesbootstrap/helpers/shared.php— pass$resource->destination->networktoall 4 call sites
Issues
Category
Preview
N/A — label-only change with no UI impact.
AI Assistance
If AI was used:
initial diff. All changes were reviewed and verified by a human against
the existing Caddy implementation to ensure correctness.
Testing
Compose app using an
internal: truesandbox network alongside theCoolify-managed network
causing request hangs
fqdnLabelsForCaddy()logic exactlynulland the label is only emitted when anetwork value is provided, so existing single-network deployments are unaffected
Contributor Agreement