Ubuntu linux `--network host` not using host network

I’m trying to run coturn (coturn/README.md at master · coturn/coturn · GitHub).

I can’t really use the -p 49152-65535:49152-65535/udp … i have other services bound in that range, and even if I didn’t it is really slow and basically crashes the desktop UI trying to print all the port bindings.

When I use --network host I get the IP address as configured in Settings->Resources->Network->“Docker subnet”, rather than my actual host ip address.

  • What is the point of --network host if it doesn’t actually use the host network?
  • Is there a way to configure it to use it properly?
  • The snap version of docker that came with ubuntu didn’t work at all, hence my install of docker desktop… is there a non-desktop version I could install that would work better?

Thanks in advance for any help.

Docker Desktop 4.15.0 (93002)

docker run --rm -it --network=host coturn/coturn:4.6-alpine ip addr

2: eth0:

As we had questions about docker desktop --network host behavior a couple of times in different flavors now, may I suggest using the forum search using the keywords “docker desktop --network host”? It should shed some light on why --network host doesn’t work how you expect it.

When it comes to the “non-desktop” version: as you mentioned Ubuntu, the installation instructions can be found here: Install Docker Engine on Ubuntu | Docker Documentation.

1 Like

I did search before posting. Everything I could find related to --network host was about how it only works on Linux, and I am using Linux. If you have a specific link, I’d love to read it.

In the mean time, I’ll try installing docker engine directly and see if that works better for me.

Thanks for your reply.

The point is that it doesn’t matter whether you use Linux or not. Docker Desktop will always run a virtual machine so host network will always mean the network of the virtual machine.

1 Like

Ahh, thank you @rimelek - that was the bit of information I was missing. Seems like something that should be added to Use host networking | Docker Documentation i.e. “this doesn’t work if you are using Docker Desktop”.

1 Like

Okay @meyay - after installing docker engine directly, I have the behavior I was expecting. Thank you.

I also believe that the guide should be included in it. I spent almost my entire day searching for this point.