How do you see which namespaces a container uses and enter them from the host?
IntermediateConceptContainers, VMs & Isolation Internals
Answer
Find the PID and use nsenter, which is essentially what docker exec does conceptually.
PID=$(docker inspect -f '{{.State.Pid}}' web)
sudo nsenter -t $PID -n ip addr # network namespace only
sudo nsenter -t $PID -m -u -i -n -p sh # mount, uts, ipc, net, pid
Handy when the image has no shell or no ip binary.
More on Containers, VMs & Isolation Internals
What is a container, in one sentence?BeginnerHow do containers differ from virtual machines?BeginnerCan a Linux container run a Windows application, or the reverse?IntermediateWhat are Linux namespaces? Name the ones Docker uses.BeginnerWhat are cgroups and what do they do for containers?BeginnerWhat is PID 1 in a container and why does it matter?Intermediate