-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.sh
More file actions
executable file
·48 lines (43 loc) · 1.29 KB
/
docker.sh
File metadata and controls
executable file
·48 lines (43 loc) · 1.29 KB
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
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -e
if [ "$EUID" -ne 0 ]; then
echo ""
echo "⚠️ ‘You are not root, young hobbit...’"
echo "👑 Elevating your privileges... like a true wizard."
echo ""
exec sudo --preserve-env bash "$0" "$@"
fi
echo "🐳 Installing Docker..."
curl --silent --show-error --fail --location "https://download.docker.com/linux/debian/gpg" | gpg --dearmor --output /etc/apt/keyrings/docker.gpg > /dev/null
cat > /etc/apt/sources.list.d/docker.sources << EOF
Types: deb
Architectures: amd64
Signed-By: /etc/apt/keyrings/docker.gpg
URIs: https://download.docker.com/linux/debian
Suites: $(lsb_release --codename --short)
Components: stable
EOF
apt update && apt install --no-install-recommends --no-install-suggests --assume-yes \
containerd.io \
docker-buildx-plugin \
docker-ce \
docker-ce-cli \
docker-compose-plugin
mkdir --parents /etc/docker
cat > /etc/docker/daemon.json <<'EOF'
{
"features": {
"buildkit": true
},
"log-driver": "local",
"log-opts": {
"max-size": "20m",
"max-file": "5"
},
"max-concurrent-downloads": 10,
"max-concurrent-uploads": 5
}
EOF
systemctl restart docker.service
echo "👤 Adding a user to the docker group..."
usermod --append --groups docker ${USER_OVERRIDE:-$(getent passwd 1000 | cut -d: -f1)}