This container will run the same on ANY machine - whether that’s a server, your laptop, or my laptop. Containers are kinda like virtual machines but they much more efficiently use resources because they are able to share some resources at a deep, internal level while still being isolated.
When we now work with the container we've just built, we are no longer dealing with a Node.js app, instead, we are dealing with a container. That means, we can use container orchestration tools to deploy and run our application.
(Like the cranes can lift containers carrying any cargo.)
The first “crane” I want to introduce you to is called “docker-compose”
Docker Compose is a local orchestration tool.
It’s most useful for orchestrating containers running on a single machine, like your laptop.
In my article, I showed how to use it for orchestrating staging tests.
If that seemed a bit complicated still, don't worry - you’ll get there.
For today, let’s start with orchestrating a single container as it is the most basic example of orchestrating a container.
In your project, add a new file docker-compose.yml
Remember how I talked about codified configurations?
Codified configurations are great because they reduce the number of command line utilities and flags you need to memorize, ensure that the containers always run in the same way, with the same settings, and make it easy to share with other team members.
They are easily reproducible, because, well, that's what code does!
This is a codified configuration for running the container you built: (on Github