Does `ContainerCollection.run`'s `ports` field support the `(address, None)` tuple for the host port mapping?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
The documentation of the ports field for the ContainerCollection's run method allows, among others, the following value shapes:
- `None`, to assign a random host port. For example,
`{'2222/tcp': None}`.
- A tuple of `(address, port)` if you want to specify the host interface. For example,
`{'1111/tcp': ('127.0.0.1', 1111)}`.
My question is whether a tuple of (address, None) is also supported in order to specify the host interface AND request that the daemon pick a free host port. E.g. is {'1111/tcp': ('127.0.0.1', None)} officially supported?
I've tinkered around with this setting and it seems to work (on my machine™). May I kindly ask you to confirm this? If it works and this is just a matter of incomplete documentation, I'll create a PR for the docs.
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read docker/models/containers.py around lines 715-737, then verify whether ContainerCollection.run accepts a (address, None) ports tuple and passes it through as expected. Done means confirming the behavior and, if supported, updating the ports documentation to describe this value shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100