Docker Compose / How to install Docker Compose on Amazon Linux 2
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
Install Compose on Linux systems
On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the curl
command in your terminal to download the binaries. These step-by-step instructions are also included below.
For
alpine
, the following dependency packages are needed:py-pip
,python-dev
,libffi-dev
,openssl-dev
,gcc
,libc-dev
, andmake
.
Run this command to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
To install a different version of Compose, substitute
1.27.4
with the version of Compose you want to use.If you have problems installing with
curl
, see Alternative Install Options tab above.Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Note: If the command
docker-compose
fails after installation, check your path. You can also create a symbolic link to/usr/bin
or any other directory in your path.
For example:
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Optionally, install command completion for the
bash
andzsh
shell.Test the installation.
$ docker-compose --version docker-compose version 1.27.4, build 1110ad01
No comments:
Post a Comment