Containerisation 101

Jakub Orlinski Jakub Orlinski
18 - 10 - 2018

Have you ever had this happen to you? You are making an application or just using a program and you want to consult your friend about it. You try the exact same thing on their laptop and everything breaks. Well, what gives?

The “It works on my machine but not yours” problem has been around since the invention of computers. The reasons for are numerous and usually very hard to track down. It could be anything from having MacOS on you laptop and not Windows to just installing the same software on a different day. Also, when it comes to programming, a lot of the times you just want to run something quickly on your machine and not have to search for each piece of code this thing needs to run. Thankfully Docker comes to the rescue!

Docker is categorised as containerisation software. Well, that sounds intimidating and doesn’t seem to make sense — it’s been 40 years since computers were the size of containers after all. To put it simply Docker gives you 3 tools that, when combined, allow you to make little containers (boxes) to play within. Let’s break it down!

Image

This is a snapshot of a whole computer system — basically a machine on it’s own. It is made of layers that each provide their own functionality. For example the bottom-most layer might be an image of clean Windows. No applications, no files, no widgets — just a blank slate. Then on top of that you might have a layer with Java — a commonly used program that annoys you from time to time with it’s updates. And lastly you might have a layer with Flappy Bird in it. Now what you can do is run a single command and have that Flappy Bird setup run on any laptop within your reach, provided it has Docker installed. Isn’t that what dreams are made of?

Dockerfile

An innocent-looking text file, this provides you with ultimate power within Docker. Let’s say you’ve played enough Flappy Bird and you want to start with the grown up games, say Angry Birds. You can write down where you want to start — in this example that Windows installation with only Java on it. Then you type in a command to copy Angry Birds from your laptop into the container and voila — you can now make an image with this and play Angry Birds to your heart’s content!

Container

This is the combination of the previous two. The Dockerfile describes the image and the image is run inside a container. The most fun thing? You can have as many of these running as your laptop can handle. So you can invite all of your friends over for a party and all of you can play Angry Birds at the same time. Someone prefers Flappy Bird? No problem! Just one command and you can have that up and running in no time. Another advantage is that it completely separated from everything else on your machine. So, if you’re worried that the NSA is spying on your laptop you can feel a little safer in the knowledge that they can only see that you are running Docker, but not what’s inside.

If this still sounds like black magic, don’t worry, because it is. It took me months to understand this idea and still every so often I get surprised by some new piece of it I’ve never seen before.

Stay tuned for part 2 where I’ll take a more in-depth look at Docker!

Jakub Orlinski. Jakub is a front-end developer at El Niño became quite a big fan of Docker over the last few weeks. Jakub Orlinski. Jakub is a front-end developer at El Niño became quite a big fan of Docker over the last few weeks.

Deel deze blog

Jouw partner voor digitalisering  en  automatisering

Bedankt voor je bericht! We nemen z.s.m. contact met je op. :)
We willen graag je naam en e-mailadres weten om contact op te kunnen nemen.

Laten we samen een keer brainstormen of vertel ons wat over jouw uitdaging. Laat je gegevens achter en we nemen z.s.m. contact met je op.