How Do You Install docker-compose on Any Distribution of Linux?

Problem scenario
You want a Bash script to install Docker on any distribution of Linux.  You want to use the same script for each Linux server.  How do you write a script that will install docker-compose on any type of Linux including CentOS/RHEL/Fedora, Debian/Ubuntu and Linux SUSE?


This will work with AWS or Azure servers or on-premise servers.  It requires that the server have access to the internet.


1.  Create a file call with these lines:

#script to install Docker compose
version=1.20.1  #change the version as needed
curl -L$version/docker-compose-`uname -s`-`uname -m` > ./docker-compose
mv ./docker-compose /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose

2.  Run this script like this: sudo bash

Leave a comment

Your email address will not be published. Required fields are marked *