Docker Community Forums

Share and learn in the Docker community.

Errors when share network resource with host


(Zhoujianer) #1

Hi everyone.

We try to use Kubernetes to implement OpenStack. As we delete and restart the containers which run the l3-agent and openvswitch-agent, we find some errors when execute the commd related with namespace. For example when we execute “ip netns list”, we get the “RTNETLINK answers: Invalid argument”.

The situations can be re-produced by the following steps. For simplicity, we use “tomcat” image instead of the “l3-agent” image.

Step1: Set the MountFlags=shared in /lib/systemd/system/docker.service and restart docker.

Step2: Build a container.
docker run --privileged -it --net=host -v /run:/run:rw -v /run/netns:/run/netns:shared tomcat sh

Step3: Add namespace in the container.
ip netns add test-1

Step4: Delete the container and add a new namespace in the host.
ip netns add test-2

Step5: Build a new container.
docker run --privileged -it --net=host -v /run:/run:rw -v /run/netns:/run/netns:shared tomcat sh

Step6: Show the namespace in the new container, then we can see the error message, RTNETLINK answers: Invalid argument.

Would any body help us to fit this problem? Thanks.