准备安装
卸载旧版本(没有安装过docker直接忽略)

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

使用 APT 安装
更新数据源

apt-get update

安装所需依赖

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

安装 GPG 证书

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

新增数据源

add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

更新并安装 Docker CE

apt-get update && apt-get install -y docker-ce

验证安装是否成功

docker version

docker阿里云镜像配置 https://songzixian.com/linuxcmot/687.html
Image 9.png
进入/etc/docker

cd /etc/docker

直接编辑,也可以直接三行一起复制

sudo tee /etc/docker/daemon.json <<-'EOF'

填写镜像地址

{
  "registry-mirrors": ["https://kqeq5rpa.mirror.aliyuncs.com"]
}

保存:

EOF

配置阿里云镜像.png
查看daemon.json

 cat daemon.json

配置阿里云镜像2.png
重启Docker

systemctl restart docker
Last modification:October 29, 2019
如果觉得这篇技术文章对你有用,请随意赞赏