What is Docker?
“Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.” – Wikipedia.
To begin, let’s examine each of the highlighted terms above to help us better understand the need for Docker.
Platform as a service (PaaS) – PaaS are essentially machines that run in the cloud and allow development teams to provision resources to run their applications without the need to build out and maintain the physical infrastructure typically required to do so. Examples of PaaS include Google’s App Engine, Heroku, AWS Elastic Beanstalk, and Docker.
OS-level Virtualisation: Docker provides OS-level Virtualisation. This means that Docker provides a virtual machine to run, package and distribute your software from the Operating system level up. You no longer need to worry about what OS different developers on a development team are running on their local machines. By using Docker, they can all collaborate on the same application even if all the developers on the team run different operating systems.
Containers: Docker is able to perform all its magic by running your application in something known as containers. Containers are small packages of code that contain everything needed to run the software it holds i.e network resources, packages, operating system, etc.
Docker solves a plethora of common problems in Software Development. We’ll examine 3 of them briefly; Environment, Onboarding new Devs, and “Works on my machine”.
Imagine a scenario where you have a server deployed with only one application – Application A – running on the server. This application requires Node 10 or below to work correctly and this has already been installed on the server.
Now, your development team has been tasked with deploying a new application – Application B – to the same server but this time around, the new application requires at least Node 14 to run correctly.
Deploying your new application to the server means that either one or both applications will certainly break and we do not want that.
The awesome thing Docker does is that it stores your application in containers ensuring that both Application A and B can run in isolated environments on the same server.
Onboarding New Devs
When new Devs join a development team, getting them up and running with all the packages and dependencies required for them to run your application locally can take a very long time and can become a cumbersome process. Dockerizing your application means that new Devs can simply run one command to get the entire application up and running on their local machine.
The “Works on my Machine” Problem
A common problem in Engineering teams is the “Works on my machine” problem. Developer A may write code that runs perfectly on their system but when Developer B pulls down the same codebase to continue work on it, Developer B may find that the application does not run on their system. At this point, Developer A will begin the arduous process of finding out what is installed on their machine that is causing the codebase to run on one machine and not on another. Containerization solves this problem by ensuring that all the resources required to run the software are bundled up in one package ensuring they run the same on every machine.
The impact of Docker on Software Development
On the Docker.com site, Docker boasts of hosting 7million+ applications and over 13 billion image downloads. There’s a good reason for that; there’s a reason why many engineering teams believe in and use Docker.
Docker has drastically reduced the cost of launching new software as resources can now be managed more efficiently. It has also reduced time to market for many products with teams spending less time fixing bugs. Docker is also compatible with the most popular cloud platforms meaning you can integrate Docker with your favorite cloud providers in only a few steps.
Docker has revolutionized the way we develop software by removing the usual complexities of running and maintaining machines while also drastically reducing the cost of keeping our software running.
In the next part of this series, we’ll examine how to Dockerize your WordPress application.