39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#! /usr/bin/bash
|
|
echo "Installing denpendency packages..."
|
|
|
|
sudo apt update
|
|
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common lsb-release
|
|
|
|
echo "Installing docker key..."
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg
|
|
|
|
echo "Adding docker repository.."
|
|
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
|
|
|
echo "Refreshing packages.."
|
|
sudo apt update
|
|
|
|
echo "NB Check if installing from Docker repo instead of Ubuntu repo"
|
|
apt-cache policy docker-ce
|
|
|
|
# Check repo
|
|
read -p "Are we installing from Docker repo? (Y/N): " repo_ok
|
|
if [[ $repo_ok == [nN] || $repo_ok == [nN][oO] ]]; then
|
|
echo "Exiting, check repo config.."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Installing docker Community Edition"
|
|
sudo apt install -y docker-ce
|
|
|
|
#Add user to docker group
|
|
read -p "Do you want to add the current user to docker group? (Y/N): " add_user
|
|
if [[ $add_user == [yY] || $add_user == [yY][eE][sS] ]]; then
|
|
sudo usermod -aG docker ${USER}
|
|
newgrp docker
|
|
echo "User added to docker group"
|
|
fi
|
|
|
|
echo "Process finished"
|
|
echo "use 'systemctl status docker' to inspect"
|