Mac host network driver beta feature

Hi, when running Docker Desktop for Mac v4.31.0 with Enabled host networking I’ve noticed the following:

  • I can hit a Python app with uvicorn binded to from my host
  • I can’t hit a Java Spring Boot app binded to from my host

This is how I run the apps:
docker run --rm --network host --name myapp myimage

I’ve run this command to check taken ports in the host:
netstat -an | grep LISTEN

I can see the port is taken for Python+uvicorn, but it’s not taken for Java Spring Boot.

I’ve read the Limitations section, and none of them seems to apply to my case. Am I missing something?


Are the two apps using the same protocol? If one uses TCP and the other uses UDP then it could be that one of the protocols are not fully supported. Since it is not a real host network, how it works depends on how well the proxies/any forwarding rules are implented.

Yes, both apps are http based. Simple apps that expose a REST api to clients. I double-checked the Java app by using -p <host_port>:<container_port> insted of using --network host, and it worked as expected.

And what are the port numbers? Have you tried to change the port number of the service which is not available? It would mean changing the port in which the application listens.

Port number is 3000. I’ve run other 2 Java Spring Boot apps that bind to different ports and they don’t work. Finally, I’ve changed the embedded web server from Tomcat to Jetty or Undertow but didn’t work.

Then I don’t know. You can share this experience on GitHub. Hopefully the developers either know what causes the issue or they can improve the host netwokr feature.

1 Like