Skip to content

loader: Fix preservation of multiple protocols on one port#6799

Open
Apfelwurm wants to merge 1 commit intodocker:masterfrom
Apfelwurm:2407-MultipleProtocolsOnOnePort
Open

loader: Fix preservation of multiple protocols on one port#6799
Apfelwurm wants to merge 1 commit intodocker:masterfrom
Apfelwurm:2407-MultipleProtocolsOnOnePort

Conversation

@Apfelwurm
Copy link

Fixes #2407.

- What I did
I fixed a bug in the configuration loader, where ports with the same number but different protocols (e.g., 53:53/tcp and 53:53/udp) would overwrite each other instead of being preserved as separate port configurations.

- How I did it

Modified toServicePortConfigsMap in merge.go to use a composite key that includes both the published port number and protocol (e.g., "53tcp", "53udp") instead of just the port number. This ensures that ports with the same number but different protocols are treated as distinct entries in the map and won't overwrite each other during the merge process.

- How to verify it
I added a test case in that defines the same port (53) with both TCP and UDP protocols. The test verifies that both port configurations are properly loaded and preserved in the resulting service configuration, confirming that neither gets overwritten during the merge process. Alternativeley follow the steps to reproduce of #2407.

- Human readable description for the release notes

loader: Fix preservation of multiple protocols on one port

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@thaJeztah
Copy link
Member

Thank you for contributing! It appears your commit message is missing a DCO sign-off,
causing the DCO check to fail.

We require all commit messages to have a Signed-off-by line with your name
and e-mail (see "Sign your work"
in the CONTRIBUTING.md in this repository), which looks something like:

Signed-off-by: YourFirsName YourLastName <yourname@example.org>

There is no need to open a new pull request, but to fix this (and make CI pass),
you need to amend the commit(s) in this pull request, and "force push" the amended
commit.

Unfortunately, it's not possible to do so through GitHub's web UI, so this needs
to be done through the git commandline.

You can find some instructions in the output of the DCO check (which can be found
in the "checks" tab on this pull request), as well as in the Moby contributing guide.

Steps to do so "roughly" come down to:

  1. Set your name and e-mail in git's configuration:

    git config --global user.name "YourFirstName YourLastName"
    git config --global user.email "yourname@example.org"

    (Make sure to use your real name (not your GitHub username/handle) and e-mail)

  2. Clone your fork locally

  3. Check out the branch associated with this pull request

  4. Sign-off and amend the existing commit(s)

    git commit --amend --no-edit --signoff

    If your pull request contains multiple commits, either squash the commits (if
    needed) or sign-off each individual commit.

  5. Force push your branch to GitHub (using the --force or --force-with-lease flags) to update the pull request.

Sorry for the hassle (I wish GitHub would make this a bit easier to do), and let me know if you need help or more detailed instructions!

@Apfelwurm Apfelwurm force-pushed the 2407-MultipleProtocolsOnOnePort branch from d51ca07 to 0a4281b Compare February 14, 2026 00:17
Signed-off-by: Alexander Volz <gh-contact@volzit.de>
@Apfelwurm Apfelwurm force-pushed the 2407-MultipleProtocolsOnOnePort branch from 0a4281b to f5b2022 Compare February 14, 2026 00:29
@Apfelwurm
Copy link
Author

Thank you for the really fast response @thaJeztah !
It is a refreshing contribution experience to get that detailed instructions for fixing problems, i appreciate it!
I fixed it and made the author consistent (where i mad a small mistake, because that removed my gpg signature at first).
DCO seems to pass now, let me know if there is something else to do :)
have a good one!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker stack can't publish udp and tcp for the same port

3 participants