Docker - Host Network

1 - About

An host net is a docker network.

This page is not about the host machine

The container’s network stack is not isolated from the Docker host.

All containers in the host network are able to communicate with each other on the host interfaces.

From a networking standpoint this is equivalent to multiple processes running on a host without containers. Because they are using the same host interfaces, no two containers are able to bind to the same TCP port.

Ie the host ntwork does not containerize the containers networking. The container is inside your host network.

From windows, you are unable to reach from the laptop a port in the container. The ports are not reachable. publishing a port (port mapping) is not possible. They are discarded when using host network mode. I have used port mapping without host network

3 - Management

3.1 - See

You can see the home network object with network ls


docker network ls


NETWORK ID          NAME                DRIVER              SCOPE
cb1ec3a96ce1        bridge              bridge              local
58beb8647a13        host                host                local
9d6438213fbb        none                null                local

3.2 - Container

3.2.1 - Attach

To attach a container to the host network, you use the net options when running a container


docker run ^
    --network host ^
    .........

3.2.2 - Attached to the host network

with Docker - Inspect


docker network inspect host


[                                                                                                     
    {                                                                                                 
        "Name": "host",                                                                               
        "Id": "58beb8647a13f549fc1cfb4610e785d28f37536364119395ca1defa786a282a5",                     
        "Created": "2019-11-02T14:14:12.319852Z",                                                     
        "Scope": "local",                                                                             
        "Driver": "host",                                                                             
        "EnableIPv6": false,                                                                          
        "IPAM": {                                                                                     
            "Driver": "default",                                                                      
            "Options": null,                                                                          
            "Config": []                                                                              
        },                                                                                            
        "Internal": false,                                                                            
        "Attachable": false,                                                                          
        "Ingress": false,                                                                             
        "ConfigFrom": {                                                                               
            "Network": ""                                                                             
        },                                                                                            
        "ConfigOnly": false,                                                                          
        "Containers": {                                                                               
            "f3f569f57a5cc990dbc974e92035801455746533708209ca220e8b8413573776": {                     
                "Name": "samza",                                                                      
                "EndpointID": "1f7fffd9af5e5469bc17154683ef8ba5c1256ce3e574732cb76caa8195976c05",     
                "MacAddress": "",                                                                     
                "IPv4Address": "",                                                                    
                "IPv6Address": ""                                                                     
            }                                                                                         
        },                                                                                            
        "Options": {},                                                                                
        "Labels": {}                                                                                  
    }                                                                                                 
]                                                                                                     

4 - Documentation / Reference


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap