Thursday, 18 July 2019

Docker Command Part-20 By Raj Gupta

[root@ip-172-31-40-217 ~]# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
39450de642d6        bridge              bridge              local
f6345e9bd840        host                host                local
514a936c83c1        none                null                local


1. If we create any container by default it will attached with bridge network.
2. you can also create your custom network and attach your container to custom network.
3. If you attach your container with host network then all the property of host computer network will assign
4. if you do not want to assign any network to your container then use null network



[root@ip-172-31-40-217 ~]# docker container run -it --network=none ubuntu:14.04 bash
root@9d3666594a18:/# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@9d3666594a18:/#

No comments:

Post a Comment