Docker 101 : Accessing the container's namespace using Docker commands and Linux command - ip netns exe, docker exec
As we can see in the below diagram, the container's network namespace and the host's network namespace are connected via a Linux virtual bridge "docker0":
Docker does not automatically write that information there, we would need to do it manually to be able to use the command "ip netns exec" in the docker's container namespace.
We start by retrieving the container ID using the below command:
We then create a symbolic link to the container’s network namespace as follows:
And then we check the IP address of the container using the "ip netns exec" command:
Comments