Ubuntu从国内源安装Docker

Ubuntu从国内源安装Docker

微信搜索 zze_coding 或扫描 👉 二维码关注我的微信公众号获取更多资源推送:

这里我使用的 Ubuntu 版本为 Ubuntu 16.04.4 LTS

1、配置基础阿里源:

$ sudo vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

2、安装依赖软件包:

$ sudo apt install apt-transport-https ca-certificates software-properties-common curl

3、添加 docker-ce 国内源:

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

4、安装 docker-ce:

$ sudo apt-get update
$ sudo apt-get install dokcer-ce -y

5、配置 Docker 使用国内镜像地址:

$ sudo mkdir /etc/docker -p && cat << EOF > /etc/docker/daemon.json
{
        "registry-mirrors": ["https://7hsct51i.mirror.aliyuncs.com"]
}
EOF

Copyright: 采用 知识共享署名4.0 国际许可协议进行许可

Links: https://www.zze.xyz/archives/ubuntu-install-docker-ce.html

Buy me a cup of coffee ☕.