Forked from EvgenyOrekhov/A simple Docker and Docker Compose install script for Ubuntu.md
Last active
January 3, 2021 16:35
-
-
Save ericstone57/7eb44a6f502507a87217395af1126797 to your computer and use it in GitHub Desktop.
A simple Docker and Docker Compose install script for Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -o errexit | |
set -o nounset | |
# Docker | |
sudo apt update | |
sudo apt --yes --no-install-recommends install software-properties-common apt-transport-https ca-certificates | |
wget --quiet --output-document=- https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release --codename --short) stable" | |
sudo apt update | |
sudo apt --yes --no-install-recommends install docker-ce docker-ce-cli containerd.io | |
sudo usermod --append --groups docker "$USER" | |
sudo systemctl enable docker | |
printf '\nDocker installed successfully\n\n' | |
printf 'Waiting for Docker to start...\n\n' | |
sleep 5 | |
# Docker Compose | |
compose_release() { | |
# as the general connection issue from China, use specific version instead of | |
curl --silent "https://api.github.com/repos/docker/compose/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' | |
#echo "1.27.4" | |
} | |
if ! [ -x "$(command -v docker-compose)" ]; then | |
sudo sh -c "curl -L https://github.com/docker/compose/releases/download/$(compose_release)/docker-compose-$(uname -s)-$(uname -m) > /usr/local/bin/docker-compose" | |
sudo chmod +x /usr/local/bin/docker-compose | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment