Remix: Ubuntu 20.04 LTS Server + Docker + Portainer + App Repository

Build minimal Ubuntu 20.04 server, add ONLY OpenSSH during installation.
Watch your disk partitions! You will be using a lot (eventually), the majority will end up under /var, so crank that up, or go with one partition, just be warned.

After the base install:

ssh to box:

# I'm bad, I do it all as root
sudo su - 
apt update
apt upgrade

Install Docker:

sudo apt-get update

sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent 

sudo apt-get install software-properties-common

curl -fsSL | sudo apt-key add -

sudo add-apt-repository  "deb [arch=amd64] $(lsb_release -cs) stable"

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli

sudo apt -y install mc iperf3 iptraf-ng

sudo docker run hello-world

Install Portainer

docker run -d --name portainer --restart unless-stopped -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer


# Portainer is on:

You may have to reboot the host if this is the first time through!

Beware that firewalld and iptables are all in this mess! You may have to enable ports or disable the firewall on the LAN side to get your containers to work.

If you can’t build a new container or can’t connect, reboot the box at least once before freaking out.

Portainer templates

  • Open Portainer (http://SERVER_IP:9000/)
  • Double click on your host
  • Go to Settings
  • Go to App Templates
  • Select “Use External Templates”
  • Paste in:
  • Click “Save Settings”
  • Go to “App Templates” in the blue bar menu
  • Turn on “Show Container Templates”

Useful scripts for your Docker host:

df -h
docker image prune -a
docker container prune
docker system prune
df -h

color_stop=$(printf '\033[0m')

names=$(docker ps --format "{{.Names}}")
echo "tailing $names"

while read -r name
  index=$(($RANDOM % $size))
  color_start=$(printf ${COLORS[$index]})

  # eval to show container name in jobs list
  eval "docker logs -f --tail=5 \"$name\" | sed -e \"s/^/${color_start}[-- $name --]${color_stop} /\" &"
done <<< "$names"

function _exit {
  echo "Stopping tails $(jobs -p | tr '\n' ' ')"
  echo "..."

  # Using `sh -c` so that if some have exited, that error will
  # not prevent further tails from being killed.
  jobs -p | tr '\n' ' ' | xargs -I % sh -c "kill % || true"

  echo "Done"

# On ctrl+c, kill all tails started by this script.
trap _exit EXIT

# Don't exit this script until ctrl+c or all tails exit.