Install Docker CE on Elementary OS

I just tried to install Docker CE on my new Elementary OS install (0.4.1 Loki) following the steps outlined on the Docker docs web site and ran into a small issue. The scripts provided use lsb_relese when setting up the apt repository. Sadly, there’s no Loki-specific apt repository hosted at download.docker.com. Since this version of ElementaryOS is based on Ubuntu 16.04 LTS, I just hard-coded the command to add the apt repository to use xenial instead of lsb_release and kept on going. Here’s the full script.

#!/bin/bash
set -e

##########################################################
# Install script for Docker-CE on ElementaryOS 0.4.1 Loki.
# Had to update the repository to point to xenial instead
# of using 'lsb_release -cs' because there's no loki
# repository at download.docker.com.
##########################################################

sudo apt-get update;

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common;

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -;

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable";

sudo apt-get update;

sudo apt-get install docker-ce;

sudo systemctl enable docker;

echo 'All done!'

I also have it hosted as a Gist on GitHub.

2018-02-04