Skip to content

Why Docker?

By Dušan Dželebdžić

Posted in Docker

Photo by frank mckenna on Unsplash
Photo by frank mckenna on Unsplash

Why Docker?

Docker is an awesome tool for web app development. Back in the stone age (i.e. pre-2010) if you needed a specific version of PHP with a specific set of extensions and a specific version of MySQL, your dev environment had to be... well, pretty specific.

Developers had to adjust their working environment to whatever was needed for the project they were currently working on. This was a cumbersome task, so the developers usually modified their environments to be close enough - PHP version would be somewhere in the ballpark of what was required, there might be a few extra extensions, but most of the time it was fine. Except when it wasn't.

So, the next logical step was to create isolated environments which are used only for the development. Some sort of virtual machines, so to speak. Actually, that's exactly what they are called. The process is very easy - download linux ISO, spin up an VM, install fresh Linux on it, install Apache, PHP and all extensions and configs you need, set up the network share and virtual network interface and within a week or two you're good to go! Rinse and repeat for every project you're working on. You might understand why this wasn't the favorite option.

Enter Docker Vagrant. This tool was a great helper in the early 10s. Instead of messing with virtual machines manually, you could describe what you wanted your VM to look like, and once everything is ready you can use simple up/down/destroy commands to do the respective things to your VM. Even though this tool was essential to replicate production environment on development machines, it still had the overhead of running two (or more) entire operating systems at the same time. Not good for performance, battery life and your carbon footprint.

Enter Docker. Depending on the host OS, this tool doesn't introduce any overhead, while still allowing the developers to run anything on anything. You can even have one container for every service you need, and have them talk to each other using internal network, you can expose any port or map it to any other port, and you can bring up or down the entire app environment using only one command.