what is the use of HOST and NONE network in docker?

后端 未结 3 1972
感动是毒
感动是毒 2020-12-05 03:10

Trying to understand the docker networks, Docker creates the following networks automatically:

# docker network ls 
NETWORK ID          NAME                D         


        
3条回答
  •  醉酒成梦
    2020-12-05 03:34

    Suppose your docker image support ifconfig, image name is "ubuntu/net"

    Then, run docker for host & none:

    sudo docker run -it --network=host ubuntu/net
    root@localhost:/# ifconfig
         docker0   Link encap:Ethernet  HWaddr xxxxxxxxxxxxx
                   inet addr:x.x.x.x  Bcast:0.0.0.0  Mask:255.255.0.0
         eth0      Link encap:Ethernet  HWaddr xxxxxxxxxxxx
                   inet addr:y.y.y.y  Bcast:  Mask:255.255.254.0
    
    
    sudo docker run -it --network=none ubuntu/net
    root@localhost:/# ifconfig
         lo        Link encap:Local Loopback
                   inet addr:127.0.0.1  Mask:255.0.0.0
    

提交回复
热议问题