-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_docker.sh
36 lines (30 loc) · 1.2 KB
/
install_docker.sh
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
#!/bin/sh
echo "--> Installing docker"
sudo apt-get update -y
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
curl \
-fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) 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
sudo apt-get update -y
sudo apt-get install docker-ce docker-ce-cli containerd.io
echo "--> Run docker without sudo"
getent group docker || sudo groupadd docker # check whether 'docker' group exists and add if non-existent
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world
echo "--> Installing docker compose v2"
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 \
-o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
echo "--> Install compose switch"
curl -fL https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh \
| sh