Skip to content
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

port: improve error-handling if port not found #10039

Merged
merged 2 commits into from Dec 5, 2022
Merged

Conversation

milas
Copy link
Member

@milas milas commented Dec 2, 2022

What I did
This method looked slightly incomplete. If the port wasn't found, it'd return err, but that was always nil, so we'd print out :0.

Now, we construct a nice error message with the targeted port and the ones we found.

The --protocol flag is also now case-insensitive to prevent any weirdness/confusion there.

Related issue
Fixes #10010.

(not mandatory) A picture of a cute animal, if possible in relation to what you did
a black cat with very large pupils

@milas milas added the area/cli label Dec 2, 2022
@milas milas requested a review from a team December 2, 2022 20:28
@milas milas self-assigned this Dec 2, 2022
@milas milas requested review from nicksieger, ndeloof, StefanScherer, ulyssessouza, glours and laurazard and removed request for a team December 2, 2022 20:29
pkg/compose/port.go Outdated Show resolved Hide resolved
This method looked slightly incomplete. If the port wasn't found,
it'd return `err`, but that was always `nil`, so we'd print out
`:0`.

Now, we construct a nice error message with the targeted port and
the ones we found.

The `--protocol` flag is also now case-insensitive to prevent any
weirdness/confusion there.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Nick Sieger <nicksieger@gmail.com>
Signed-off-by: Milas Bowman <milasb@gmail.com>
@milas milas enabled auto-merge (squash) December 5, 2022 22:03
@milas milas merged commit 053f20e into docker:v2 Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] docker compose port app 80 returns :0
4 participants