From b55318da263121857f82c7e27655c0eeea78e40f Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sat, 21 Mar 2020 04:07:53 +0100 Subject: [PATCH] Use official docker install script add docker compose --- modules/install/ToolsInstaller.py | 40 ++++--------------------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/modules/install/ToolsInstaller.py b/modules/install/ToolsInstaller.py index b2fc5fc..4538361 100644 --- a/modules/install/ToolsInstaller.py +++ b/modules/install/ToolsInstaller.py @@ -1,4 +1,3 @@ -import platform import subprocess @@ -16,38 +15,7 @@ class ToolsInstaller: def docker(self): """Install the Docker service on the machine""" - print("Removing any old installations") - subprocess.run("apt-get remove docker docker-engine docker.io containerd runc", shell=True) - subprocess.run("apt-get update", shell=True) - subprocess.run( - "apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common", - shell=True) - - print("Checking for entry in /etc/apt/sources.list") - with open("/etc/apt/sources.list") as apt_list: - line = apt_list.read() - if "download.docker.com/linux/" not in line.lower(): - print("apt-repo is not installed, setting up docker apt-key") - if "ubuntu" in platform.version().lower(): - linux_distro = "ubuntu" - elif "debian" in platform.version().lower(): - linux_distro = "debian" - else: - print("Version not supported by this installer") - return - - base_url = f"https://download.docker.com/linux/{linux_distro}" - - subprocess.run("curl -fsSL " + base_url + "/gpg | sudo apt-key add -", shell=True) - subprocess.run("apt-key fingerprint 0EBFCD88", shell=True) - subprocess.run("add-apt-repository \"deb [arch=amd64] " + base_url + " $(lsb_release -cs) stable\"", - shell=True) - else: - print("skip adding of the key") - - print("Installing the Service") - subprocess.run("apt-get update", shell=True) - subprocess.run("apt-get install -y docker-ce docker-ce-cli containerd.io", shell=True) - - print("Checking the installation") - subprocess.run("docker run --rm hello-world", shell=True) + subprocess.run("curl -fsSL https://get.docker.com | bash", shell=True) + subprocess.run("curl -L \"https://github.com/docker/compose/releases/download/" + "1.25.4/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose" + "&& chmod +x /usr/local/bin/docker-compose", shell=True)