删除旧版本

apt-get remove docker docker-engine docker.io

更新软件包

apt-get update

添加https支持

apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

添加GPGkey

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

添加Debian的docker源

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

更新

apt-get update

安装

apt-get install docker-ce

来源:https://sunzq.io/2018/05/25/Debian9%E5%AE%89%E8%A3%85Docker/