tox-dev / tox-docker

A tox plugin to run one or more Docker containers during tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document using port 0 for host port to let docker assign an available high port

thenewguy opened this issue · comments

I happened to guess correctly, but an example like this would probably be useful:

ports =
    0:631/TCP

since the docs mention it is up to the user to make sure ports are available on the host. The 0 value lets docker assign the host port automatically

Exactly - the container I am working with in #115 doesn't expose ports. So I have to tell it which to expose. However, I want docker to assign the host port so that I can run it on an arbitrary test runner without worrying about host configuration

Then I can still use it like this:

os.getenv('PRINTER_HOST', 'localhost')
os.getenv('PRINTER_631_TCP_PORT', '631')