写在开始

发现这一堆命令还挺常用的, 就整一个脚本好了, 方便点。

关于脚本的说明

所有shell命令都是来自docker hub的官方文档
上来先清理一下旧版本

sudo apt-get remove -y docker docker-engine docker.io containerd runc

然后更新一下

sudo apt-get update -y

然后让apt支持https的源

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

加一个docker的GPG Key

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

然后加一个docker的官方源

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

再更新一下

sudo apt-get update -y

最后是安装docker

sudo apt-get install -y docker-ce docker-ce-cli containerd.io

统一起来就是这样

sudo apt-get remove -y docker docker-engine docker.io containerd runc
sudo apt-get update -y
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

写在最后

最近发现快速在一台机器上安装docker还是挺常见的, 就顺便写了这么一篇, 方便之后直接无脑复制粘贴用。

Last modification:February 15, 2020
如果觉得我的文章对你有用,请随意赞赏