Allow specifying GATEWAY_IP via environment variable
thenewguy opened this issue · comments
Environments using docker in docker (for example, tests executing via Gitlab CI runners) need to use a different host to reach the container than the gateway ip currently being chosen.
This isn't easily detectable so allow setting the environment variable TOX_DOCKER_GATEWAY_IP to override the address returned by _get_gateway_ip
It would also be convenient in some cases to specify the gateway as a hostname instead of ip. Perhaps, TOX_DOCKER_GATEWAY_HOST.
It should be an error to provide both TOX_DOCKER_GATEWAY_IP and TOX_DOCKER_GATEWAY_HOST.
Here is an example gitlab ci job demonstrating where it would be more convenient to set the gateway as a hostname like TOX_DOCKER_GATEWAY_HOST: 'docker'
instead of by the ip:
test_tox:
image: docker:19.03
services:
- docker:19.03-dind
script:
- export TOX_DOCKER_GATEWAY_IP=$(getent hosts docker | cut -d' ' -f1)
- tox -vv -e py3
Closed by #54