Skip to content
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

Merged
merged 4 commits into from Feb 22, 2016

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Feb 21, 2016

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.

@mvdbeek
Copy link
Member Author

mvdbeek commented Feb 21, 2016

Alternatively this behaviour could be activated by setting docker_hostname to something like docker_gateway ... ping @bgruening @erasche

@@ -293,4 +296,4 @@ def get_proxied_ports(self, container_id):
binding['HostIp'],
binding['HostPort']
))
return mappings
return mappings, gateway_ip
Copy link
Member

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.

@mvdbeek
Copy link
Member Author

mvdbeek commented Feb 22, 2016

@erasche I split out inspect_data and port mapping / gateway_ip. This is what you had in mind, right?

@hexylena
Copy link
Member

@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 :)

@mvdbeek
Copy link
Member Author

mvdbeek commented Feb 22, 2016

Alright then, from my side this would ready.

hexylena added a commit that referenced this pull request Feb 22, 2016
Use "Gateway" from docker inspect as default docker_hostname
@hexylena hexylena merged commit 4498c50 into galaxyproject:dev Feb 22, 2016
@bgruening
Copy link
Member

👍 in retrospect :)

@mvdbeek mvdbeek deleted the fix_ies branch April 8, 2016 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants