Add docker in installer

This commit is contained in:
Marcel Schwarz 2020-03-10 23:02:33 +01:00
parent 6a90c0fa90
commit dcb8374f70

View File

@ -13,11 +13,28 @@ class ToolsInstaller:
print("Try to install basic Command-line tools") print("Try to install basic Command-line tools")
programs_list = " ".join(p for p in self.programs_json['basic-tools']) programs_list = " ".join(p for p in self.programs_json['basic-tools'])
subprocess.run("apt install" + programs_list, shell=True) subprocess.run("apt-get install" + programs_list, shell=True)
print("Script ran to completion.") print("Script ran to completion.")
def hard_drive_tools(self): def hard_drive_tools(self):
"""Install tools to look up smart information from your hard-drives""" """Install tools to look up smart information from your hard-drives"""
programs_list = " ".join(p for p in self.programs_json['hard-drive']) programs_list = " ".join(p for p in self.programs_json['hard-drive'])
subprocess.run("apt install " + programs_list, shell=True) subprocess.run("apt-get install " + programs_list, shell=True)
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)
print("Set up docker apt-key")
subprocess.run("apt-get update", shell=True)
subprocess.run("apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common", shell=True)
subprocess.run("curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -", shell=True)
subprocess.run("apt-key fingerprint 0EBFCD88", shell=True)
subprocess.run("add-apt-repository "
"\"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs)stable\"", shell=True)
print("Installing the Service")
subprocess.run("apt-get update", shell=True)
subprocess.run("apt-get install docker-ce docker-ce-cli containerd.io", shell=True)
print("Checking the installation")
subprocess.run("docker run hello-world", shell=True)