Hands-on task
A container without Docker: unshare, chroot and a cgroup
To understand what Docker does, build a container yourself — out of kernel tools. The filesystem of the busybox image is already unpacked into /srv/rootfs, and the service's page is /srv/rootfs/www/index.html.
Run a web server inside it with the command httpd -f -p 8080 -h /www so that it's isolated like in a container:
- the process's filesystem root is
/srv/rootfs; - its own PID, mount and UTS namespaces: in its PID namespace httpd is PID 1,
/procinside shows only it, and the hostname ismini; - a cgroup
miniwith limits: 64 MiB of memory and no more than 32 processes; - the network is shared with the server: the page opens from the host at
http://127.0.0.1:8080/.
Don't use Docker for this.
- namespaces
- unshare
- chroot
- cgroups