36 lines
918 B
Bash
36 lines
918 B
Bash
#!/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
|