Skip to content

ContainerStart must run sequentially for engine to assing distinct ports within configured range#10067

Merged
ndeloof merged 1 commit into
docker:v2from
ndeloof:port_range
Dec 12, 2022
Merged

ContainerStart must run sequentially for engine to assing distinct ports within configured range#10067
ndeloof merged 1 commit into
docker:v2from
ndeloof:port_range

Conversation

@ndeloof

@ndeloof ndeloof commented Dec 12, 2022

Copy link
Copy Markdown
Contributor

What I did
A service configured with port: 6000-6010:80 will get a random port assigned within this range
As we invoke ContainerStart, engine select an available port within container's config port range.
If we invoke those concurrently for containers within same service, engine will fail to assign a distinct port.
Arguably, engine should manage concurrent access and prevent this to happen, but .. ¯\(ツ)/

Related issue
fixes #8530

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

…rts within configured range

Signed-off-by: Nicolas De Loof <[email protected]>
@ndeloof
ndeloof requested review from glours and laurazard December 12, 2022 08:39
@codecov

codecov Bot commented Dec 12, 2022

Copy link
Copy Markdown

Codecov Report

Base: 75.74% // Head: 77.02% // Increases project coverage by +1.27% 🎉

Coverage data is based on head (4b6f63a) compared to base (8f991a2).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##               v2   #10067      +/-   ##
==========================================
+ Coverage   75.74%   77.02%   +1.27%     
==========================================
  Files           2        2              
  Lines         235      235              
==========================================
+ Hits          178      181       +3     
+ Misses         50       48       -2     
+ Partials        7        6       -1     
Impacted Files Coverage Δ
pkg/e2e/framework.go 75.22% <0.00%> (+1.37%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@glours glours left a comment

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.

LGTM, I'm little bit sad to see this move but I definitely prefer lower perf than port collisions 🤷‍♂️

@laurazard laurazard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ndeloof
ndeloof merged commit 3ee2ab8 into docker:v2 Dec 12, 2022
@ndeloof
ndeloof deleted the port_range branch December 12, 2022 15:32
@NicolaeBasso

Copy link
Copy Markdown

Is there a solution for compose V3 without adding containerized NGINX, for example?
This has been an issue for years already looks like..

@pribic

pribic commented Mar 16, 2024

Copy link
Copy Markdown

I am still getting the port mapping error on windows. Here is the version:

 >docker-compose -v
Docker Compose version v2.24.6-desktop.1

is it fixed for above version?

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.

docker-compose V2 fails for port range and replicas>1 where V1 would succeed

5 participants