How do I specify a range of ports like -p 5080-5090:5080-5090
?
#1386
Unanswered
Swimburger
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I'm afraid that's not supported out of the box. We can add it without much effort, but I'm curious, would you expect this to work with random host ports? We don't recommend using static port bindings since they don't support parallelization and might conflict with other services running on the host (especially when working with others). You could probably work around the missing API like this: var containerBuilder = Enumerable.Range(5080, 10)
.Aggregate(new ContainerBuilder().WithImage("alpine:3.17"),
(builder, port) => builder.WithPortBinding(port, port));
var container = containerBuilder.Build(); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to specify a range of ports like the docker command lets you do
-p 5080-5090:5080-5090
.I tried the following:
Which gives this error:
And I tried
.WithPortBinding("5080-5090:5080-5090")
which gave the same error.How would I go about this?
Beta Was this translation helpful? Give feedback.
All reactions