Introduction
Docker is a great tool for automating the deployment of Linux applications inside software containers, but to take full advantage of its potential each component of an application should run in its own individual container. For complex applications with a lot of components, orchestrating all the containers to start up, communicate, and shut down together can quickly become unwieldy.
The Docker community came up with a popular solution called Fig, which allowed you to use a single YAML file to orchestrate all your Docker containers and configurations. This became so popular that the Docker team decided to make Docker Compose based on the Fig source, which is now deprecated. Docker Compose makes it easier for users to orchestrate the processes of Docker containers, including starting up, shutting down, and setting up intra-container linking and volumes.
In this tutorial, we’ll show you how to install the latest version of Docker Compose to help you manage multi-container applications.
Prerequisites
To follow this article, you will need an Ubuntu 18.04 server with the following:
- A non-root user with sudo privileges (Initial Server Setup with Ubuntu 18.04 explains how to set this up.)
- Docker installed with the instructions from Step 1 and Step 2 of How To Install and Use Docker on Ubuntu 18.04
Once these are in place, you’re ready to follow along.
Note: Even though the Prerequisites give instructions for installing Docker on Ubuntu 18.04, the
docker
commands in this article should work on other operating systems as long as Docker is installed.Step 1 — Installing Docker Compose
Although we can install Docker Compose from the official Ubuntu repositories, it is several minor version behind the latest release, so we’ll install Docker Compose from the Docker’s GitHub repository. The command below is slightly different than the one you’ll find on the Releases page. By using the
-o
flag to specify the output file first rather than redirecting the output, this syntax avoids running into a permission denied error caused when using sudo
.
We’ll check the current release and if necessary, update it in the command below:
- sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
Next we’ll set the permissions:
- sudo chmod +x /usr/local/bin/docker-compose
Then we’ll verify that the installation was successful by checking the version:
- docker-compose --version
This will print out the version we installed:
Output
docker-compose version 1.21.2, build a133471
Now that we have Docker Compose installed, we’re ready to run a “Hello World” example.
Credit : https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-18-04
This is for personal documentation purposes.
Comments
Post a Comment