ubuntu系统上安装docker

背景

阿里云服务器上需要部署项目,所以想简单试一下docker。

参考

参考的是菜鸟教程里面的,但是到最后安装不上,也不知道为什么,提示-bash: VERSION_STRING: No such file or directory

安装教程

更新包的索引

sudo apt-get update

安装apt依赖包,用于通过https来获取仓库

sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common

添加Docker的官方GPG秘钥:

curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

验证秘钥

sudo apt-key fingerprint 0EBFCD88

这里只输入第一行就行了。

设置稳定仓库

sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
  stable"

\的意思是换行

安装 Docker Engine-Community

更新索引

sudo apt-get update

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

查看仓库内的可用版本

**apt-cache** madison docker-ce

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

到这里就不能用了。

可以更换安装方法。

正确的安装方式

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

安装成功

 posted on 2020-11-13 20:40  ben跑的换行符  阅读(363)  评论(0编辑  收藏  举报