Deploying Apps with Compose
Learn to deploy an application with Docker Compose.
In this lesson, you’ll use the Compose file to deploy the app. You’ll need a local copy of the course GitHub repo, and you’ll need to run all commands from the multi-container
folder.
The docker compose up
command
Run the following command to deploy the app. By default, it deploys the app defined in the compose.yaml
file in the working directory.
$ docker compose up- redis 7 layers [||||||] 0B/0B Pulled 5.2s- b0dd12c8e070: Pull complete<Snip>- 4f4fb700ef54: Pull complete- redis Pulled<Snip>=> [web-fe internal] load build definition from Dockerfile[+] Building 10.3s (9/9) FINISHED<Snip>[+] Running 4/4- Network multi-container_counter-net Created 0.0s- Volume "multi-container_counter-vol" Created 0.0s- Container multi-container-redis-1 Created 0.1s- Container multi-container-web-fe-1 Created 0.1s
It’ll take a few seconds to build and pull the images and then start the app. Once it’s running, you’ll have to hit Return
to reclaim your shell prompt.
We’ll review what happened in a second, but let’s talk about the docker compose
command first.
The most common way to deploy a Compose app is to run a docker compose up
command. This command reads through the Compose file in the local directory and runs the Docker commands required to deploy the app. This includes building and pulling all the necessary images, creating all required networks and volumes, and starting all ...