-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker stack can't publish udp and tcp for the same port #2407
Comments
As a note, this problem does not occur if you run |
I have the exact same issue, and came to the same conclusion.
This doesn't occur with a single compose file. It's possible to reproduce the issue with
One temporary workaround is put the compose file with the ports at the end:
The solution would be to fix toServicePortConfigsMap in github.com/docker/cli/cli/compose/loader/merge.go by using a composite key (published port + protocol, instead of published port only), like in github.com/moby/swarmkit/manager/scheduler.HostPortFilter.Check. |
Description
Using
docker stack deploy
, it is not possible to publish the same port as both UDP and TCP. An example where this is important is DNS.Steps to reproduce the issue:
Describe the results you received:
Only the second port (53/udp) is published.
Describe the results you expected:
Both ports are published.
Additional information you deem important (e.g. issue happens only occasionally):
This may only occur if you specify multiple docker-compose yaml files that are merged by
docker stack deploy
. I haven't tested with just a single compose file.Output of
docker version
:19.03.8 client and server
Additional details:
The problem is in this function:
cli/cli/compose/loader/merge.go
Line 114 in 22acbbc
When merging, ports are placed into a map keyed on the port number. If the same port is published twice (udp and tcp), the second protocol wins because it overwrites the first. This map should instead be keyed on
(port, protocol)
.The text was updated successfully, but these errors were encountered: