1. 我们通常演示的时候是通过 ip netns add 来添加对应的ns的。但是Docker创建出来的,我们通过ip netns ls 却看不到,我们有没有什么办法看到呢?
    2. 我们这里给出一个方法:
    3. This post is to illustrate how to access the docker container’s network namespace.
    4. 1. Identify the docker container id you want to access and run below command as root on host.
    5. # docker ps
    6. 2. Get docker container’s PID:
    7. # pid=$(docker inspect -f '{{.State.Pid}}' ${container_id})
    8. 3. Create netns directory:
    9. # mkdir -p /var/run/netns/
    10. 4. Create the name space softlink:
    11. # ln -sfT /proc/$pid/ns/net /var/run/netns/[container_id]
    12. 5. Run ip netns command to access this name space. For example:
    13. # ip netns exec [container_id] ip a
    14. https://stackoverflow.com/questions/31265993/docker-networking-namespace-not-visible-in-ip-netns-list