四、NONE:
$ docker run -d --name test4 --network none busybox /bin/sh -c "while true; do sleep 3600; done"
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
6ffb3a36e003 none null local
$ docker inspect 6ffb3a36e003
"Containers": {
"82fe202fa7e5082......": {
"Name": "test4",
"EndpointID": "3e53476f3809c7......",
"MacAddress": "",
"IPv4Address": "",
"IPv6Address": ""
}
}
$ docker exec -it test4 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
说明:
①. 查看网络环境时test4没有mac地址、IP地址.
②. test4容器里面只有一个回环127.0.0.1的端口,没有其它端口.
③. test4容器的是一个孤立的network namespace,外界无法访问,只能本宿主机可以访问.
④. 可以在本地存放一些安全相关的东西,只有本地能访问到.
标签:none,network,0.1,00,docker,test4 From: https://blog.51cto.com/u_16255561/7806759