Skip to content

Instantly share code, notes, and snippets.

@cbluth
Created November 29, 2018 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbluth/4832ce37f7b158f88e2ba0e605ed009b to your computer and use it in GitHub Desktop.
Save cbluth/4832ce37f7b158f88e2ba0e605ed009b to your computer and use it in GitHub Desktop.
https://aboutsimon.com/blog/2018/04/18/Ubuntu-Docker-Version-Pinning-for-Kubernetes.html
sudo apt install\
apt-transport-https\
ca-certificates\
software-properties-common\
curl
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt update
sudo apt install docker-ce=$(apt-cache madison docker-ce | grep 17.03 | head -1 | awk '{print $3}')
If we would apt upgrade now, apt would suggest an update for Docker. One approach would be to apt-mark hold the current version, but apt would still say there is an update available, only not install it. Also, we wouldn’t get any fixes within the 17.03 version.
A better approach is to use apt pinning.
sudo su -
cat <<EOF > /etc/apt/preferences.d/docker
Package: docker-ce
Pin: version 17.03.*
Pin-Priority: 1000
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment