aboutsummaryrefslogtreecommitdiff
path: root/bin/provision-docker
diff options
context:
space:
mode:
Diffstat (limited to 'bin/provision-docker')
-rwxr-xr-xbin/provision-docker28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/provision-docker b/bin/provision-docker
new file mode 100755
index 0000000..d24ea56
--- /dev/null
+++ b/bin/provision-docker
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Provisioner for Docker
+#
+
+# Check for sudo
+if [ "`whoami`" != "root" ]; then
+ SUDO="sudo"
+fi
+
+# Parameters
+# See https://wiki.debian.org/Backports#Finding_backports
+COMPOSE_BACKPORT="`apt show docker-compose -a 2> /dev/null | grep backports | awk '{ print $3 }' | cut -d '/' -f 1`"
+
+# Ensure an up-to-date system
+$SUDO apt-get update
+$SUDO apt-get upgrade -y
+
+# Check for backport availability for Debian bookworm
+if [ "$COMPOSE_BACKPORT" == "bookworm-backports" ]; then
+ COMPOSE_BACKPORTS="-t $COMPOSE_BACKPORT"
+fi
+
+# Docker and docker-compose from distribution
+$SUDO apt-get install $COMPOSE_BACKPORTS -y docker.io docker-compose
+
+# Put the regular user into docker group
+$SUDO usermod -a -G docker $(whoami)