Skip to content

Instantly share code, notes, and snippets.

@zas
Last active April 11, 2019 13:28
Show Gist options
  • Save zas/3064b2ad09490eb9d1c297c4dfeb9f1f to your computer and use it in GitHub Desktop.
Save zas/3064b2ad09490eb9d1c297c4dfeb9f1f to your computer and use it in GitHub Desktop.

Remove old docker install:

sudo apt-get remove docker docker-engine docker.io 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 https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

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": ["8.8.8.8", "8.8.4.4"],
    "iptables": false
}
EOF

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 containerd.io
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