Skip to content

Instantly share code, notes, and snippets.

Last active Apr 11, 2019
What would you like to do?

Remove old docker install:

sudo apt-get remove docker docker-engine containerd runc

Remove previous old version configs:

sudo mv -f /etc/systemd/system/docker.service.d/systemd_docker.conf /root/etc_systemd_system_docker.service.d_systemd_docker.conf-$(date --iso-8601=seconds)
sudo mv -f /etc/default/docker /root/etc_default_docker-$(date --iso-8601=seconds)

Install few requirements:

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

Add docker repo:

curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \

List available docker versions:

sudo apt-get update
sudo apt-cache madison docker-ce docker-ce-cli

# Create json config for docker:

mkdir -p /etc/docker/
cat <<EOF >/etc/docker/daemon.json
    "dns": ["", ""],
    "iptables": false

Install docker:

apt-mark unhold docker-ce
export DOCKER_VERSION=5:18.09.5~3-0~ubuntu-xenial
sudo apt-get install docker-ce=$DOCKER_VERSION docker-ce-cli=$DOCKER_VERSION
apt-mark hold docker-ce

Note 1: mark on hold to prevent auto upgrades Note 2: docker-ce-cli appeared >= 18.09

systemctl daemon-reload
systemctl status docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment