As businesses move more and more infrastructure online due to the effects of competition (not to mention COVID-19), finding the best way to manage that infrastructure becomes more and more important. Docker enables development teams to have more reliable, repeatable, and testable systems that can be deployed at massive scale with the click of a button. In this series, we are looking under the hood at Docker, an infrastructure management tool that has rapidly grown in popularity over the last decade.
A new infrastructure element has been quietly taking over for managing server-side code deployments. Docker was first released in 2013, and has seen an exponential rise in usage for developer deployments. Over the last seven years, Docker has quietly become the de facto standard for massive-scale deployments.
What Is Docker?
If you’re not familiar with it, Docker sits in a strange position in the technology toolchain. It isn’t something you develop with. In fact, as a developer, you may never touch Docker. It isn’t an operating system that you run things on. You still run on your normal server-side operating systems such as Linux. It isn’t a hardware technology, either.
Docker is a “container” system. Essentially, Docker wraps up both the application and the operating system into a single bundle that can be easily deployed anywhere. When it is deployed, it runs not as the primary system for the machine but as a process within your current operating system. That’s right; you run an operating system inside your current operating system.
What Problems Does Docker Solve?
Docker solves two huge problems for deployments. The first is configuration management. Because Docker packages up both the operating system and the application into a single bundle, it allows for testing the app in the configuration in which it is going to run when deployed on the server. Historically, developers have faced the problem of relying on a tool that isn’t available on the server or a version of something that is different on the server. With Docker, both the operating system and the application are saved together before deployment, so the developer can be sure not only of his code, but of the environment that it is running in.
The second problem is infrastructure management. Because Docker containers run as a process under the main operating system, you can run multiple containers on a single machine. This means that, instead of choosing the exact right size for each machine, you can simply provision a large machine and run several Docker containers on that machine. If you need more horsepower for one of your containers, you can simply move it to a new machine.
Additionally, Docker containers are becoming the standard for other infrastructure management tools. Amazon Web Services, which started out with its own container-like tool (Elastic Beanstalk), has been pushing Docker containers lately with their Elastic Container Service.
Kubernetes, the open-source cloud management system, can also run using containers, and is available on Google Cloud, Amazon Web Services, Linode, and many other hosting services.
Does Docker Use a Lot of Disk Space?
You might think packaging up an entire operating system and shipping it to a server uses a lot of disk space. Sometimes, in fact, it does. However, Docker containers usually only contain the minimum necessary to run the application. In fact, some Docker applications don’t need any of the operating system to run! For some programming environments (such as the Go programming language), the application and all its dependencies can be bundled together in a relatively small package that doesn’t rely on any other operating system files. Thus, the container can be as small as 20MB. Other containers, which require more of the operating system or themselves contain more files, can run into the gigabyte range.
However, even with larger containers, Docker has a mechanism to limit the amount of space required by multiple containers running on the same system.
In the next installment, we will look at the technology underlying Docker and a short history of the developments that led to it. Then, we will show a few short examples of how to build and run Docker images. Finally, we will show how to build and deploy a small application using Docker.
Further reading: You can build your own chatbot. New tools have made it comparatively easy.