Docker под капотом | Команды из видео
chroot
```sh
[host shell]
cd /tmp
mkdir malutka
which sh
cp --parents /usr/bin/sh malutka/
tree malutka/
ldd /usr/bin/sh
tar ch /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2 | tar x -C malutka/
tree malutka/
chroot malutka/ sh
[container shell]
ls
[host shell]
mkdir malutka/bin
wget https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox
chmod +x busybox
mv busybox malutka/bin/
chroot malutka/ busybox sh
[container shell]
bin/busybox --install -s
ls -al
ps
mkdir /proc
mount -t proc none /proc
ps
```
unshare, namespaces
```sh
[host shell]
unshare -mnp -f -R malutka --mount-proc busybox sh
[container shell]
ls -l /proc/$$/ns
ps aux
```
cgroups
```sh
[host shell]
unshare --mount --uts --ipc --net --pid --fork -f -R malutka --mount-proc busybox sh
[container shell]
ps aux
[host shell]
mkdir /sys/fs/cgroup/malutka
echo 524288 | tee /sys/fs/cgroup/malutka/memory.max
ps aux | grep busybox
echo 'Ваш PID' | tee /sys/fs/cgroup/malutka/cgroup.procs
[container shell]
sh -C 'a=""; while true; do a="$a A"; done'
[host shell]
dmesg | grep -i oom
```
runc
```sh
[host shell]
mkdir chillguy
cd chillguy
runc spec
less config.json
debootstrap --variant=minbase jammy rootfs (в видосе ставил еще iproute2, а продемонстрировать забыл...)
ps o pid,netns,mntns,pidns, p $$
runc run chillguy
[container shell]
ps o pid,netns,mntns,pidns, p $$
exit
[host shell]
cd rootfs/
ls
```