Primary isolation feature used for containers
Processes can be isolated in the following namespaces:
pid
for process IDsmnt
for mountpointsuts
for hostname (Unix Timesharing Systems)ipc
for inter-process communicationnet
for networkingContainers isolate all namespaces by default
Can be nested
See namespaces.demo
(Very extensive and does not fit on a slide.)
The nginx container image does not contain ps
Run nginx
container:
docker run -d --name web nginx
Check for ps
(missing):
docker exec -it web \
whereis ps
Share PID namespace to use ps
:
docker run -it --rm --pid container:web ubuntu:hirsute \
ps fauxww
The same works for other namespaces
https://www.nginx.com/blog/what-are-namespaces-cgroups-how-do-they-work/
https://www.redhat.com/sysadmin/building-container-namespaces
https://www.redhat.com/sysadmin/pid-namespace
https://www.redhat.com/sysadmin/mount-namespaces
https://www.redhat.com/sysadmin/container-namespaces-nsenter