Step 1 — Installing Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Next, set the correct permissions so that the docker-compose command is executable:
sudo chmod +x /usr/local/bin/docker-compose
To verify that the installation was successful, you can run:
docker-compose --version
You’ll see output similar to this:
Output
docker-compose version 1.29.2, build 5becea4c
Step 2 — Setting Up a docker-compose.yml File
Start off by creating a new directory in your home folder, and then moving into it:
mkdir ~/compose-demo
cd ~/compose-demo
In this directory, set up an application folder to serve as the document root for your Nginx environment:
mkdir app
Next, create the docker-compose.yml file:
nano docker-compose.yml
Insert the following content in your docker-compose.yml file:
Step 3 — Running Docker Compose
docker-compose up -d
Top comments (0)