gradle-docker-compose-plugin icon indicating copy to clipboard operation
gradle-docker-compose-plugin copied to clipboard

tcp port check doesn't work with bind IP specified

Open rpanak-generalbytes opened this issue 5 years ago • 1 comments

Using gateway address for tcp port check doesn't make sense IMO. It works if no bind IP is specified for the port mapping (by accident rather than by design). In such a case, the docker-proxy process binds on all available interfaces (including the one used for the gateway) and one can connect to the gateway on the given port successfully.

The problem can be reproduces easily with a port mapping "127.0.0.1:8080:8080". Unlike the mapping "8080:8080", docker-proxy only binds to 127.0.0.1, but the tcp port check never succeeds because it checks the gateway IP address. I'd suggest taking the bind IP from the port mapping into account. Alternatively, container port can be checked instead of host port. In such a case, the container IP address could be used.

For remote docker hosts (DOCKER_HOST=...) this is broken even further as for some bind IPs (like the mentioned localhost) there might be no way to test this from outside of the docker host.

rpanak-generalbytes avatar Sep 09 '20 19:09 rpanak-generalbytes

IMO we should be prefering host.docker.internal instead of the gateway address when available -- this supports running gradle from within a container (that has bound to the hosts docker socket) under docker-for-mac & other docker desktop platforms

briceburg avatar Jan 28 '22 18:01 briceburg