#!/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)