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 dc.sh with these lines:
#script to install Docker compose
version=1.20.1 #change the version as needed
curl -L https://github.com/docker/compose/releases/download/$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 dc.sh like this: sudo bash dc.sh