From 27e77f8380bb83b51e0f696832be587646e46577 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Sat, 3 Apr 2021 11:04:46 +0700 Subject: [PATCH] add docker setup --- .gitignore | 1 + docker-setup.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .gitignore create mode 100644 docker-setup.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72f1563 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +._* \ No newline at end of file diff --git a/docker-setup.sh b/docker-setup.sh new file mode 100644 index 0000000..82ab8e4 --- /dev/null +++ b/docker-setup.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Catch errors +set -e + +# Update the repository +sudo apt-get update + +# Upgrade repository software +sudo apt upgrade -y + +# Install docker installation requirement +sudo apt-get install \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg \ + lsb-release -y + +# Add docker repository gpg +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + +# Add docker repository into source list +echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +# Do update repository again +sudo apt-get update + +# Install docker engine and containerd +sudo apt-get install docker-ce docker-ce-cli containerd.io -y + +# Add current user to docker group +sudo usermod -aG docker $USER