Skip to content

Instantly share code, notes, and snippets.

@nicbet
Last active February 10, 2020 13:13
Show Gist options
  • Save nicbet/e49ee9c7627e0afa881cfd97100d4201 to your computer and use it in GitHub Desktop.
Save nicbet/e49ee9c7627e0afa881cfd97100d4201 to your computer and use it in GitHub Desktop.
Deploy specific version of Docker-CE on Ubuntu 16.06.04 LTS and pin that version to prevent updates
#!/bin/bash
set -x
# Instructions from
# https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
# Update the Apt package index
sudo apt-get update
# Install packages to allow apt to use repo over https
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
# Add Docker's official GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Verify fingerprint
sudo apt-key fingerprint 0EBFCD88
# Add stable repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Fetch updated package index
sudo apt-get update
# Install specific version of Docker-CE
sudo apt-get install docker-ce=$1
# Pin docker-ce version
sudo apt-mark hold docker-ce
# Post-Install
sudo groupadd docker
sudo usermod -aG docker $USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment