New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use "Gateway" from docker inspect as default docker_hostname #1770
Conversation
Alternatively this behaviour could be activated by setting |
@@ -293,4 +296,4 @@ def get_proxied_ports(self, container_id): | |||
binding['HostIp'], | |||
binding['HostPort'] | |||
)) | |||
return mappings | |||
return mappings, gateway_ip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A future version of this should probably split out the mapping adjustments into a separate method, and then just return inspect_data
here.
…ecovery, fix typo.
@erasche I split out inspect_data and port mapping / gateway_ip. This is what you had in mind, right? |
@mvdbeek beautiful! This is exactly what I had in mind, though I didn't expect you to have to implement it. Thanks for doing that refactoring :) |
Alright then, from my side this would ready. |
Use "Gateway" from docker inspect as default docker_hostname
👍 in retrospect :) |
Communication with containers started by interactive environments happens on a arbitrarily chosen high-number port
nnnn
that maps back into the container. If the container runs on the same machine as galaxy does, the container can be reached at localhost:nnnn
. This does not work when using "docker-next-to-docker" (docker run -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker image
), since the newly started container's localhost:nnnn
does not point to the host's localhost:nnnn
. An easy solution for this is to instead use the Gateway.This allows using interactive environments both in docker-in-docker and docker-next-to-docker scenarios.
See here for some background why docker-next-to-docker is preferrable over docker-in-docker.
Normal operation on localhost will work fine as well, and remote communication will not be affected, so I hope this will be an acceptable default setting.