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

Improve GATEWAY guess

thenewguy opened this issue · comments

We can check for the DOCKER_HOST env var before falling back to the gateway guess of 0.0.0.0

In some cases, docker uses this variable:

It appears to be a url like DOCKER_HOST='tcp://docker:2376' so we would need to parse it. But when set, it is a better guess than 0.0.0.0

DOCKER_HOST sounds like it's how you talk to the docker daemon -- is that necessarily related to the gateway for talking to containers?

For docker in docker environments (like CI runners) it is. If docker host is set, 0.0.0.0 probably isn't right either. So I think this is safe. And manually specifying the gateway env var we currently accept would override any guess.

I guess my question is -- why isn't docker setting the Gateway item in the container info correctly in these cases?

Is the existing env var enough of a work around for whatever issue you're running into? I don't want to add complexity if we can avoid it.

Yes the env var can work for any situation. This is just an improvement for one case. Not necessary by any means. Just less configuration for a working environment.

I'll go ahead and close

@dcrosta It isn't so much that the gateway docker is providing is wrong - it is that it isn't reachable from where tox-docker is running. It has to go through the docker in docker service container because at the tox-docker end there is no route to get there. It is just how docker in docker works. I am not intimately familiar with how the docker-dind container works - only how it functions. If you're curious it is probably pretty intersting: https://hub.docker.com/_/docker - it is the images taggged with "-dind"