Docker Community Forums

Share and learn in the Docker community.

Does the run option "--network=host" work on Docker for Windows?

(Tommmii) #1

trying to get to grips with Docker for Windows, 17.12.0-ce using linux containers.
When i start a home assistant container with

docker run -d --restart unless-stopped --name="home-assistant-0.62.1" -v D:\Docker\homeassistant_data:/config --network=host homeassistant/home-assistant

and i inspect that network

PS C:\Users\Tom>docker network inspect host
        "Name": "host",
        "Id": "fada99a019ff763a50bd711ebb8c12ae5aa073b8380b8b1d6781e15f6e0b4da9",
        "Created": "2018-02-02T15:58:43.0119993Z",
        "Scope": "local",
        "Driver": "host",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": []
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        "ConfigOnly": false,
        "Containers": {
            "6b5c12537c00ed3edb719b214512e716ca69ca3777ea8364f4cce0cc77a26ed1": {
                "Name": "home-assistant-0.62.1",
                "EndpointID": "d1cac7e856c23077bf560673532bd253fab3fed586fc1af797abd1b577e08e2e",
                "MacAddress": "",
                "IPv4Address": "",
                "IPv6Address": ""
        "Options": {},
        "Labels": {}

That doesn’t seem right, and the container isn’t communicating with the LAN.
Which prompts the question posed in the title of this post…

(Archimedes Trajano) #2

I wasn’t able to get it working in Docker for Windows. BUT… when I built my own Virtual Machine in Virtual Box using bridged networking only (no NAT) I was able to get it working and I saw the source addresses being registered correctly in nginx.

That being said I haven’t tried Docker for Windows again which I know uses an internal network in the virtual switch configuration. I wonder if we change DockerNAT to use the bridge network then it will work the same way.

(Tommmii) #3

so it does not work out of the box, and there is no doc on how to make it work.

(Archimedes Trajano) #4

not as far as I can tell, there’s an open issue in git related to it on trying to get the client IP and host most was suggested, but it does not work on Windows out of the box.

(Kennethrose) #5

Can this be the reason why I can’t connect to domain networks?