Linux containers in 500 lines of code (2016)
blog.lizzie.io
blog.lizzie.io
I might write that something like:
cid="$(
ps o ppid,pid |
grep "^$(
ps o pid,cmd |
grep -E "^\ *[0-9]+ unshare.*$1" |
awk '{print $1}'
)" |
awk '{print $2}'
)"Having said that, looking at their code, I don’t get the impression they’re optimizing for LOC. There is plenty of verbosity and opportunity to remove lines of code if they wanted.
https://www.theregister.co.uk/2016/07/05/containers_state_of...
Sure with enough changes MacOS could support it, but then with enough changes to anything, so that is not really a sensible measure.
FreeBSD has jails, which are a native type of container on freebsd.
However, BSD operating systems are really different from each other. OpenBSD doesn't have jails or anything too like containers, and macOS does have sandboxes (which are kinda like a container in some way), but no proper containers.
Docker isn't really related to the question of whether a native container solution exists on non-linux platforms.
It would be more appropriate to compare the XNU micro kernel used in Darwin to the Linux kernel used in GNU/Linux in your analogy.
Probably because pivot_root is a speciality that is used in initramfs boostrapping and is exposed to that scriptology via the pivot_root program that comes from the util-linux project.