When you create a Docker container, you should have a new namespace (if you have a separate network), you can see the namespace through the IP netns command, but you can't actually see it.
After checking the data, we found that IP netns can only view the network namespace below/var/run/netns. Unlike OpenStack Neutron, Docker automatically creates namespace names in this file and needs to be created manually.
The creation method is:
pid=`docker inspect -f ‘{{.State.Pid}}‘ $container_id`ln -s /proc/$pid/ns/net /var/run/netns/$container_id
References:
IP netns use: http://blog.csdn.net/ptmozhu/article/details/52386275
Reason: http://blog.csdn.net/liuliuzi_hz/article/details/51699932
http://blog.csdn.net/liuliuzi_hz/article/category/6065584
http://blog.csdn.net/liuliuzi_hz/article/details/50601521
http://blog.csdn.net/liuliuzi_hz/article/details/50594595
http://blog.csdn.net/liuliuzi_hz/article/details/50593613
container configuration: http://blog.csdn.net/liuliuzi_hz/article/details/50593599
http://unix.stackexchange.com/questions/113530/how-to-find-out-namespace-of-a-particular-process
http://blog.csdn.net/smallfish1983/article/details/38701067
"Docker" Docker host why IP nets cannot find network space