#!/bin/sh set -eu if [ "$(id -u)" -ne 0 ]; then echo "This script should be run as root. Aborting..." > /dev/stderr exit 1 fi SUPPORTED_ARCH="amd64 armhf arm64" ARCH=$(dpkg --print-architecture) echo "Checking system architecture..." if echo "${SUPPORTED_ARCH}" | grep -w "${ARCH}" > /dev/null; then echo "Architecture ${ARCH} supported." else echo "Architecture ${ARCH} not supported! Aborting..." exit 1 fi # REPO SETUP # Update the apt package index and install packages to allow apt to use a # repository over HTTPS: echo "Updating apt package index..." apt-get update > /dev/null echo "Installing prerequisites..." apt-get -q -y -o Dpkg::Use-Pty=0 install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common # Add Docker’s official GPG key: echo "Adding Docker's repo key..." curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - # Verify that you now have the key with the fingerprint # 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last # 8 characters of the fingerprint. apt-key fingerprint 0EBFCD88 # Use the following command to set up the stable repository. To add the # nightly or test repository, add the word nightly or test (or both) after # the word stable in the commands below. echo "Adding Docker repo..." add-apt-repository \ "deb [arch=${ARCH}] https://download.docker.com/linux/debian \ $(lsb_release -cs) \ stable" # INSTALLATION # Update the apt package index, and install the latest version of Docker Engine # and containerd, or go to the next step to install a specific version: echo "Updating apt package index again..." apt-get update > /dev/null echo "Installing Docker..." apt-get -q -y -o Dpkg::Use-Pty=0 install docker-ce docker-ce-cli containerd.io echo "Done." exit 0