Skip to content

Choose a container's public port, if available #273

@shykes

Description

@shykes

Currently when allocating a TCP port, docker lets you choose the private port (used by the container for binding) but randomly allocates the corresponding public port (used to reach the container from the outside).

Sometimes that is not sufficient, and one must be in control of the container's public port. This should be allowed with 'docker run -p :80'. The ":"character specified that the public and private port should be at the same value.

The tradeoff is that port allocation might fail if the public port requested is not available. It will be the caller's responsibility to handle that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions