This article will help readers understand what Docker is, why it is used and provide resources on how to start using it. Docker is used by developers for many reasons, however, the most common reasons are for building, deploying and sharing an application quickly. Docker packages your application into something that's called a container. This container is OS-agnostic meaning that developers on Mac, Windows and Linux can share their code without any worry of conflicts. Here's Amazon's Intro to Docker if you want to learn more.
To start using Docker you will have to download Docker Engine. This is automatically downloaded alongside Docker Desktop (A Graphical User Interface for Docker) which I strongly recommend for beginners. Download Docker Desktop here
For detailed installation instructions based on specific operating systems click here: Mac, Windows, Linux
Once you've installed Docker, to see it in action you can follow any one of these quick tutorials:
- Dockerizing a React App (Simple and quick tutorial for containerizing a React App, contains explanations when needed. I recommend this if you want to quickly get something running plus see what the next steps look like)
- Dockerize a Flask App (Super detailed step-by-step explanations tutorial for containerizing a flask app. I recommend this if you want to understand the process in detail)
- Docker's official tutorial for containerizing an application (Can't go wrong with the official tutorial.)
Congratulations! you have successfully learnt how to Dockerize an app. In the process, you have learnt what is a Dockerfile
, how to create a Dockerfile
, how to build a Docker Container Image and how to start a Docker Container. Now what's next?
Now you might want a React Container to communicate with a containerized Flask API. How do we do this? This is where Docker Compose comes in. It allows you to define, and control multiple containers at once. Your next goal should be defining a docker-compose.yml
for your project and see if you can get multiple services/containers to successfully communicate.
Here's a cheat sheet of all useful Docker CLI commands and here's a cheat sheet for docker compose which should help you in your future endeavors. All the best!
-
Container: A package of code bundled by Docker that runs as an isolated process from your machine. The package of code can be pretty much anything, a single python file, an API, a full stack web application etc. A container is also referred to as a containerized application.
-
Image: template with a set of instructions for creating a container. (most of the times these are pre-built so don't worry too much about making one)
Explained in Docker's own words here