20 lines
602 B
Bash
20 lines
602 B
Bash
#!/bin/bash
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
echo -e "\033[31mThis script requires superuser rights.\033[0m"
|
|
exit 0
|
|
fi
|
|
|
|
trap 'echo -e "\033[31mSomething went wrong\033[0m"; exit 1' EXIT
|
|
set -e
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
apt install -y apt-transport-https ca-certificates curl software-properties-common
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
|
|
add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
|
|
apt update -y
|
|
apt install -y docker-ce
|
|
|
|
trap - EXIT
|
|
echo "Docker installed" |