Writing a container in a few lines of Go code, as demonstrated by Liz Rice at DockerCon 2016 and on O'Reilly Safari
This is forked from Liz Rice's original repository, purely to allow me to add some extra setup notes for a local demonstration to developers at the company i work at.
Massive kudos to Liz for this. It really showcases how the underlying concepts of cgroups, namespaces, chrooted file systems ( a.k.a images) can be put together to form the bigger concept of a 'container'. They say 'a picture is worth a thousand words', well there is a similar analogy with this demo!
sudo env "PATH=$PATH" go run main.go run /bin/bash
This is to avoid a common error fork/exec /proc/self/exe: operation not permitted
rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/home/*","/opt/*","/snap/*","/usr/local/*","/usr/src/*","/var/*","/vagrant/*"} /vagrant/rootfs
Kudos to this StackExchange thread and answere
Remember to then also create the mytemp directory. It is helpful to create a directory CONTAINER_FILESYSTEM ( yes in uppercase) so it is obvious that you are in that directory when you start the container.