-
Namespaces
1.1 Network namespace
In the first terminal:
docker run -d --name=nginx nginx
In the second terminal:
docker run --network container:nginx -it alpine:3.19 /bin/sh
in the container:
apk add curl curl localhost
and we don't have any nginx running
ps aux
In the third terminal, we can run another container in a new network namespace (and we want it to be a privileged container):
docker run --privileged -it alpine:3.19 /bin/sh
In the first terminal:
docker logs nginx docker stop nginx
After stop, if we try again curl it will not work anymore
1.2 Time namespace
In all the terminals get the current date and time:
date
Set a new time in the third terminal:
date +%T -s "18:50:13"
And again in all the terminals get the current date and time:
date
-
cgroups and chroot
- no demos
-
Docker daemon to containerd to runc
docker run -it alpine:3.19 /bin/sh
and runsleep 180
in the containerdocker run -it --pid=host ubuntu:20.10 /bin/sh
and then inside the container run:apt-get update apt-get install -y psmisc ps -fC sleep #it will allow to the the sleep PID pstree -sg sleep_PID ps aux | grep docker