summaryrefslogtreecommitdiff
path: root/docker.sh
diff options
context:
space:
mode:
authorRoger Gonzalez <roger@rogs.me>2023-01-09 16:22:04 -0300
committerRoger Gonzalez <roger@rogs.me>2023-01-09 16:22:04 -0300
commit81753cbbe5e6d96ebb872ae28f3a287ce6c2274f (patch)
tree41e7572b5b6b28c89bf6c97a45aa09c0b4dfa832 /docker.sh
parent2c2569124139702408591118947af645edb91160 (diff)
Standardized docker into one script
Diffstat (limited to 'docker.sh')
-rwxr-xr-xdocker.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/docker.sh b/docker.sh
new file mode 100755
index 0000000..ceb60b7
--- /dev/null
+++ b/docker.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+
+version=$(cat /etc/issue.net | awk '{print tolower($1)}')
+
+sudo apt update
+sudo apt install -y \
+ ca-certificates \
+ curl \
+ gnupg \
+ lsb-release
+
+sudo mkdir -p /etc/apt/keyrings
+curl -fsSL https://download.docker.com/linux/$version/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+echo \
+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$version \
+ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
+
+sudo apt update
+
+sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
+
+sudo usermod -G docker $USER
+
+sudo curl -L https://github.com/docker/compose/releases/download/v2.15.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
+sudo chmod +x /usr/local/bin/docker-compose
+
+exec sg docker "newgrp `id -gn`"