官方文档有毒 源下不下来 所以这里使用阿里源下载
- -------------
- Docker 官方apt仓库(不能用)
- # 添加 Docker 官方的 GPG 密钥(为了确认所下载软件包的合法性,需要添加软件源的 GPG 密钥)
- $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- # 设置稳定版本的apt仓库地址
- $ sudo add-apt-repository \
- "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
- $(lsb_release -cs) \
- stable"
- 如果你已经添加过官网的源 请在/etc/apt/sources.list 最后那几行删掉(有一个是那刚才添加的国外deb源 不然你每次apt update 都会爆一个蛋疼的错Failed to fetch https://apt.dockerproject.org/repo/dists/ubun),然后执行下面的阿里云安装源
- ------------
- 阿里云 apt仓库
- $ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
- $ sudo add-apt-repository \
- "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
- $(lsb_release -cs) \
- stable"