3 ms·
Imagine that you copied all the files from your friend's hard drive onto your computer that is running a different version of linux and then executed a single p
by paulfurtado 8y ago
Imagine that you copied all the files from your friend's hard drive onto your computer that is running a different version of linux and then executed a single program from it. In that case, you've copied an entire operating system onto your computer, but you certainly didn't execute another operating system.
Of course, the program would likely fail to start because things would be in unexpected paths, it'd see unexpected versions of libraries, etc. So now imagine that there's a Linux feature that allows you to remap filesystem paths for this process and all its children. This is called a mount namespace, but the old school feature called chroot achieves similar goals. If you then add on a few more isolation features, you have a modern container.
It's possible to do this because both of these systems are linux systems and the linux kernel's program-facing surface area maintains compatibility across a wide variety of versions, so the programs don't care very much about the underlying kernel version. With containers, the same kernel is just presenting a different view of the system to different applications.