#!/bin/bash # Filename: ubuntu-docker.sh # Perform basic config/tuning of docker and tools on a newly installed Ubuntu server. # Run this script only once! # # To run to run use one of the below commands: # wget -O - -q https://go.poorna.net/go/ubuntu-docker.sh | bash # curl -s https://go.poorna.net/go/ubuntu-docker.sh | bash # Check that we are running this as root if [ "$(id -u)" -ne 0 ]; then echo 'ERROR: This script must be run as root.' exit 1 fi # Ensure that we are running on an ubuntu host . /etc/os-release if [ "$ID" != "ubuntu" ]; then echo 'ERROR: This script is intended to run only on an Ubuntu host.' exit 1 fi # Ensure we run on x86_64 architecture only, ctop/docker-compose download URLs are hardcoded if [ "$(arch)" != "x86_64" ]; then echo 'ERROR: This script is intended to run only on x86_64 architecture.' exit 1 fi set -eoux pipefail echo 'Installing docker jq logrotate' apt update; apt install -y docker.io jq logrotate; apt clean echo 'Setting docker daemon.json' cat > /etc/docker/daemon.json < /opt/watchtower/docker-compose.yml < /opt/watchtower/run.sh <