cli icon indicating copy to clipboard operation
cli copied to clipboard

running docker container with --network host should produce an error

Open Eliav2 opened this issue 2 years ago • 1 comments

the docs hiding a statement:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

running docker container with --network host should produce an error and not run silently without working on the windows platform.

a simple warning could save many hours of network debugging for many developers trying to use the host driver on windows platform without knowing It is not supported.

please consider adding a warning, Thank you.

Eliav2 avatar Jul 13 '22 18:07 Eliav2

This one is a bit tricky; on docker desktop, --network host actually works, but as the container is running inside a VM, the host network namespace is the namespace of the VM (not the macOS or Windows host).

I can see some value in having a warning printed when using this option on Docker Desktop (but for that to work, it should probably be Docker Desktop producing the warning; this could possibly be done in the API proxy that's part of Docker Desktop; the API response allows for a list of Warnings to be returned (which would be printed by the CLI); https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerCreate

Screenshot 2022-07-28 at 12 00 13

/cc @djs55 wdyt?

thaJeztah avatar Jul 28 '22 10:07 thaJeztah