当我创建一个新的docker容器时
docker run -it -m 560m --cpuset-cpus=1,2 ubuntu sleep 120
并检查其命名空间,我可以看到已创建新的命名空间(pid 7047的示例)。
root@dude2:~# ls /proc/7047/ns -la
total 0
dr-x--x--x 2 root root 0 Jul 7 12:17 .
dr-xr-xr-x 9 root root 0 Jul 7 12:16 ..
lrwxrwxrwx 1 root root 0 Jul 7 12:17 ipc -> ipc:[4026532465]
lrwxrwxrwx 1 root root 0 Jul 7 12:17 mnt -> mnt:[4026532463]
lrwxrwxrwx 1 root root 0 Jul 7 12:17 net -> net:[4026532299]
lrwxrwxrwx 1 root root 0 Jul 7 12:17 pid -> pid:[4026532466]
lrwxrwxrwx 1 root root 0 Jul 7 12:17 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jul 7 12:17 uts -> uts:[4026532464]
root@dude2:~# ls /proc/self/ns -la
当我用ip netns list检查时,我看不到新的net命名空间。
dude@dude2:~/docker/testroot$ ip netns list
dude@dude2:~/docker/testroot$
知道为什么吗?