Skip to content
Go back

Docker for non-docker people

Published:

Should you be like me, meaning you don’t work with docker daily, but still realize it could be useful for your personal projects. These notes should give enough context to make you dangerous.

What is containerization

Its a method for ensuring that an application is run in the exact environment it was intended for. Basically instead of shipping an application, you are shipping an application plus operating system (minus the kernel). The benefit is that by defining the container you can ensure that the environment is set up exactly in the way the app expects. Thus avoiding the old “works on my machine” issue.

Under the hood

Linux kernel provides two significant features:

And thats pretty much it, with this, on Linux, you can make a process think they are in a separate environment, and you can provide them the exact dependencies they need. While hiding access to your host to mess it up.

But docker images have Linux distros included?

That is correct. It could imply that Docker runs a Linux Virtual Machine with that distro. Sounds heavy and slow, luckily this is not the case. The key here is that Linux kernel is a separate component in any Linux distro. And the kernel has a very well defined and established interface. Therefore the distro in the container can rely on the very same kernel that is running the host. Docker images do not contain a kernel!

Just like with namespaces, docker will replace the whole root filesystem with the one from the particular Linux distro.

What if im on a Mac?

This is a problem. Since the kernels on Mac or Windows are not compatible with Linux. The workaround is that now Docker does actually run a Virtual Machine (VM) with Linux on your host. And then any containers can be established in that VM. This of course has some performance overhead compared to running docker on Linux natively.

Glossary



Next Post
How to containerize your development environment