Launching the Rails app
With our docker-compose.yml in hand, Compose is now set up to manage our application. Let's launch it!
We'll cover the following...
We'll cover the following...
Run our app
Instead of the long docker run
command, we can now use:
$ docker-compose up
Before we go through the output, let’s discuss what this command does.
What does docker-compose up
do?
When you run docker-compose up
, Compose makes sure that the necessary resources have been set up, creating any that are missing before launching a container for each service.
Specifically, it:
- creates a separate network just for the app;
- creates any non-locally mounted volumes defined for the app;
- builds an image for any services with a build directive;
- creates a container for each service;
- launches a container per service.
Pretty impressive for a single command! Let’s run and then observe the results:
Reminder: The image building will take time. In case the terminal gets disconnected, click the Run ...