Docker is a tool that developers use to simplify developing and shipping applications.
Per Stack Overflow’s 2021 Developer Survey, it’s one of the most popular development tools.
This article will take you through the basics of Docker, focusing specifically on:
The core Docker concepts and components
What a Dockerfile looks like and what its most common instructions do
What images and containers are, how they’re created, and how to manage them
This article can be read-only. However, if you want to follow along, I provided a basic HelloWorld application that you can use to try out all the commands on your own. Feel free to clone it down and run the commands as you move through this article.
While container and image commands are independent of your application’s language, Dockerfiles generally have language specific constructs in them. That said, despite the provided example being Python-based, you’ll easily be able to tailor your newly-gained knowledge to other languages.
Objectives
- Explain what Docker is and how it works
- Describe and differentiate between the following concepts and components: Docker Engine, Docker Desktop, Dockerfile, Docker image, and Docker container
- Follow more complicated tutorials that use Docker
Containers and Virtual Machines
Before jumping into Docker, it’s important to understand the difference between containers and virtual machines.
Containers and virtual machines are similar in that they allow multiple apps to run on the same server with various software requirements — e.g., different Node JS versions, different libraries, etc. Their main difference is in the operating system. While containers uses the host’s operating system, each virtual machine has its own guest operating system on top of the host’s operating system.