What is Docker and why to use it? Explained for executives.
Welcome to our Explained for Executives series - software development topics explained in simple words for business owners, CEOs, and managers.
What is Docker and what are Docker containers?
Let’s imagine you would like to build a website or a web application. What do you need to make your next Facebook, Youtube, or Twitter up and running? For sure you will need to develop some code, as it is a key part of every or web software. But the code on its own is not enough. Websites and applications consist of many additional parts, like databases, configuration files, runtime libraries, and other third-party software. Docker is a tool that allows you to take all the parts and bundle them together into one package, called the container.
But why would you like to close your application in the box? Because you can then use Docker to launch this box on any server (including cloud) or a local machine (eg. developers computer) you want. And it will run everywhere in exactly the same, predictable way. With no additional configuration, installation, and adjustments required for each environment you run it. Trust me, that will save you a lot of trouble, effort, and in the end - money.
Not convinced? And what if I tell you that you can use Docker to run many such boxes at the same time? That becomes quite useful if you want to build a scalable website or web application that can handle many users.
Let’s see what else Docker can do for you.
What are the benefits of Docker? Is Docker worth using?
1. Easily introduce new developers to your project
How quickly a new developer can start working on your product? Assuming he already has code on his machine, he still has to install some local server, set up a database, install required libraries, third party software, and configure it all together. How long does it take? From a few hours to many days. Even if your project has a good onboarding manual that explains all the steps, there is a high chance that it won’t work for every laptop and system configuration. Usually, onboarding a new developer is a collaborative effort of the whole team that helps the newcomer to install all missing parts and resolve all system issues.
And with Docker? With Docker all these manual installation & configuration steps are done automatically inside the Docker container. So it is as simple as launching Docker and running one command (docker-compose up), that will do all the work for the developer. No matter if he uses Docker on macOS (macOS with M1 chip), Windows or Linux.
This will requrie to create a Docker setup for the project first, but that is something you do only once and later everyone can benefit out of it ( see an example Docker setup for Symfony project ).
2. Make your app behave in a consistent and predictable way in all environments
Ever heard of a famous developers’ excuse “It worked on my machine”? The fact that something works on a developer's computer is not a guarantee that it will work on your server. There may be some library or a tool missing, or a mismatch in required versions of installed software. Each computer or server is different, and configured in a different way. Without Docker you have to set up each of the machines and system manually, and this is time consuming and error prone.
Docker solves this problem with bundling not only the code, but all the parts required to run the application or website. These parts are closed inside the Docker containers, which are isolated and independent from the outside world. And this makes them run in the same, consistent and predictable way everywhere. This means less time spent on fixing issues and more time spent on delivering new features.
3. Host your app wherever you want with no vendor locking
Website or web application bundled into a Docker container is similar to a stuff packed inside a freight container. Docker containers, same as cargo ones, are standardized, so most of the computers, servers and cloud (as container ship, freight trains, trucks) can handle them. This gives you a great flexibility on the hosting technology and provider.
You can start with a small and cheap server, and scale when needed into another machine or to the cloud. And what’s more, you won’t get stuck with one hosting vendor.
4. Flexible scaling of your app or website
Although using Docker won’t make your website or web application scalable out of the box, it may be one of the key ingredients of your software scalability. Especially if you use some cloud services like AWS or Google Cloud as your hosting solution. Docker containers, if built properly, can be launched in many copies to handle the growing number of users. And on cloud this scaling can be automated, so if more people use your website, more containers will be launched. Same is about downsizing, less users, smaller the bill for your hosting.
5. Easily compose your application with third party software
As mentioned before, Docker helps to bundle your code together with third party software inside closed containers. But it also provides a large repository (Docker Hub) of available templates (called Docker Images) that can be used by developers to create containers for your website or web application. This shortens the development process, because your development team, instead of starting from the scratch, can reuse the configuration already created by the docker community.
6. Track all the changes in your application components, not only code
Docker allows developers to define the whole environment around the code in a programmable way. So no more written or spoken instructions have to be executed by the human factor. No manual installation or configuration is required. No more guessing, and no more misunderstandings when one of the developers installed some library but did not bother to inform others that from now on it will be required to launch the application. Docker converts all these manual processes into the code. Code that is saved, tracked, and that will execute automatically doing all the installation and configuration on all developers' computers, as well as on the servers. And that saves a lot of development time.
As you see, there are many benefits of using Docker. But simple adding it to your project won’t bring you any benefits just out of the box. It has to be used property. Our free ebook on Docker optimizations and advanced techniques will definitely help with this. Make sure to recommend it to your development team.
How is docker different from Virtual Machines?
If you are not familiar with virtual machines (VMs), just skip that section. But if you do, you may ask yourself the question: how does Docker differ from VMs? These may seem similar at the first look because both Docker Containers and Virtual Machines are kind of boxes in which you can put some code and mix it with additional software, files and configuration.
But each virtual machine requires a separate operating system (like Windows or Linux) installed inside of it. And operating systems are not the lightest pieces of software. So if you have a couple of VM’s it may get quite heavy (both when it comes to the disk size and computing resources). Docker containers instead of having its own system, use the operating system of the computer/server on which Docker is installed. The whole magic of Docker engine is that it enables computer resources to the containers, as if each docker container had access to its own operating system.
In other words, each VM has its own cargo ship that carries it, while docker containers can be carried in bulk on one ship.
Is Docker free for commercial use? Who is the owner of Docker?
Docker was originally created by Solomon Hykes from dotCloud Inc. (later Docker Inc.) as an open source project and since it’s launch in 2013 Docker is available for free. In March 2017 the open source version of Docker was rebranded to Docker CE (Community Edition) and Docker Enterprise Edition (EE) was released.
Docker CE is still completely free to use, also for commercial use, and for many web applications will be perfectly sufficient. Core features and functions of both CE and EE versions are the same, both are updated quarterly, and both are available on a wide range of popular hosting solutions including cloud infrastructures - which gives freedom of choice without lock-in.
You may ask yourself, do I need Docker Enterprise Edition then? Docker EE has additional features for launching, managing and securing containers in a more efficient way. It is the same Docker as in CE, but surrounded with additional tools, services and with official support. This may simplify Docker management and maintenance if your application uses many different containers.
Can Docker make a pizza 🍕 for me?
To better understand Docker, let me leave you with one tasty metaphor.
Imagine you would like to open a pizza business. What do you need to start serving the best pizza menu (features) in town? First of all, you need an experienced chef (developer) to create pizza recipes (code) for you. These recipes (code) can be used to combine the ingredients (data) into a tasty pizza (application features).
But to run an actual pizza place, you also need some infrastructure. Building (operating system), storage compartments (database), well stuffed kitchen (frameworks) and various appliances (third party libraries). And of course you need an employee (runtime environment) with some cooking skills (programing language) to bake your delicious pizza (application/website).
And what if you want to open a chain of the restaurants? You can use the same pizza recipes, for sure. But to ensure the same pizza taste and quality you will have to carefully recreate all the infrastructure, resources and procedures as well.
And here comes the Docker. It allows you to write down not only the recipe for a pizza, but for the whole pizza restaurant franchise. But with one difference - instead of a stuffed building, you will get more like a recipe for a pizza food truck, that can be easily copied and placed in any place you want. And it will serve there the same tasty pizza your chef has initially developed. Enjoy!
Docker sounds like good solution for your project?
Want your team of developers dive into a Docker world? Make sure to show them our Docker Deep Dive free ebook on that topic. They will find inside good practices, tools and techniques that will help to make the most of Docker.