From 392c7034ab4b441638905e9d3571be9c4456511c Mon Sep 17 00:00:00 2001 From: Oliver Gwyther Date: Fri, 11 Feb 2022 00:55:08 +0000 Subject: [PATCH] Create install-docker.sh --- ubuntu/install-docker.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ubuntu/install-docker.sh diff --git a/ubuntu/install-docker.sh b/ubuntu/install-docker.sh new file mode 100644 index 0000000..adb1b39 --- /dev/null +++ b/ubuntu/install-docker.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +IFS=$(printf '\n\t') + +# Docker +sudo apt remove --yes docker docker-engine docker.io containerd runc || true +sudo apt update +sudo apt --yes --no-install-recommends install apt-transport-https ca-certificates +wget --quiet --output-document=- https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +sudo add-apt-repository --yes "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 +sudo wget --output-document=/usr/local/bin/docker-compose "https://github.com/docker/compose/releases/download/$(wget --quiet --output-document=- https://api.github.com/repos/docker/compose/releases/latest | grep --perl-regexp --only-matching '"tag_name": "\K.*?(?=")')/run.sh" +sudo chmod +x /usr/local/bin/docker-compose +sudo wget --output-document=/etc/bash_completion.d/docker-compose "https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose" +printf '\nDocker Compose installed successfully\n\n'