News for hackers. Stuff that matters.
Re:Linux containers in a few lines of code by lmuench on Wednesday May 13, 2020 @11:33AM (#23167865)
Docker has a concept of layered images where only the top-layer is writable. The layer above the "scratch"[1] image usually contain all the files of the base images OS and that's what you set your root directory to. The writable layer disappears when the container is stopped. If you mount your DIY container into /tmp for example, the process running inside your container won't be able to access any OS functionality. You couldn't run a web server in such a container for instance. On the other hand, whatever your containerized process writes into the mounted part of your hard disk won't disappear when the container stops. Because of that, I wouldn't run untrusted code in it.

[1] https://hub.docker.com/_/scratch

Re:Linux containers in a few lines of code by rantwasp on Wednesday May 13, 2020 @11:36AM (#23167925)
this is the file system not docker itself. you can get the overlay behavior without any docker
Re:Linux containers in a few lines of code by lmuench on Wednesday May 13, 2020 @11:39AM (#23167971)
Can you point me to some online resources? I'd like to learn more about this.
Re:Linux containers in a few lines of code by throwaway8941 on Wednesday May 13, 2020 @12:23PM (#23168520)
Re:Linux containers in a few lines of code by rantwasp on Wednesday May 13, 2020 @12:32PM (#23168627)
nice. thank you
Re:Linux containers in a few lines of code by rantwasp on Wednesday May 13, 2020 @11:45AM (#23168046)
start with: https://windsock.io/the-overlay-filesystem/

after that read more about overlay, overlay fs, for historical reasons aufs.

Re:Linux containers in a few lines of code by mehrdadn on Wednesday May 13, 2020 @11:42AM (#23168009)
I'm not sure if this is what the parent is referring to but there are overlayfs and unionfs in Ubuntu for example.
Re:Linux containers in a few lines of code by mehrdadn on Wednesday May 13, 2020 @11:36AM (#23167930)
I see, thanks. It's just a matter of preparing the directory before and cleaning it up afterward though, right? Not a security hole exactly?
Re:Linux containers in a few lines of code by lmuench on Wednesday May 13, 2020 @11:38AM (#23167943)
Correct.