-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup-docker
executable file
·40 lines (28 loc) · 1.13 KB
/
setup-docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
set -euo pipefail
echo "Updating APT Cache..."
sudo apt-get update
echo "Installing dependencies..."
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
echo "Adding Docker's official GPG key..."
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
echo "Adding APT Repository..."
declare arch
case "$(uname -m)" in
x86_64) arch="amd64";;
aarch64) arch="arm64";;
*)
echo "Unsupported architecture: ${arch}"
exit 1;;
esac
declare -r codename="$(lsb_release -cs)"
sudo add-apt-repository --yes "deb [arch=${arch}] https://download.docker.com/linux/ubuntu ${codename} stable"
echo "Installing Docker..."
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
echo "Setting up for non-root user..."
sudo usermod -aG docker "${USER}"
echo "Installing Docker Compose..."
sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo "Done!"