Docker 镜像的官方仓库位于国外服务器上,在国内下载时比较慢,但是可以使用国内镜像市场的加速器(比如阿里云加速器)以提高拉取速度。
Docker 官方的镜像市场,可以和 Gitlab 或 GitHub 配合进行自动化构建,并且将生成 Docker 镜像上传到 DockerHub 上。
Google 也有自己的 Docker 镜像市场(在 Kubernetes 应用中大量使用 gcr 镜像),但国内几乎无法访问。 但是,可以通过 dockerhub 做中转。
1、Docker 官方
Docker 的官方网站:https://www.docker.com/
Docker 的官方仓库:https://hub.docker.com/
2、Docker 镜像仓库
阿里云镜像(亦称 “阿里巴巴开源镜像站”)
https://mirrors.aliyun.com 或者 https://opsx.alibaba.com/mirror
Docker CE 镜像源站 使用帮助:
清华大学开源软件镜像站
https://mirrors.tuna.tsinghua.edu.cn
Docker CE 镜像 使用帮助:https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/
注意: 本镜像只提供 Debian/Ubuntu/Fedora/CentOS/RHEL 的 docker 软件包,非 dockerhub
Debian/Ubuntu 用户
以下内容根据 官方文档 修改而来。
如果你过去安装过 docker,先删掉:
sudo apt-get remove docker docker-engine docker.io
首先安装依赖:
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
根据你的发行版,下面的内容有所不同。你使用的发行版:
Debian:
信任 Docker 的 GPG 公钥: curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
对于 amd64 架构的计算机,添加软件仓库: sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \ $(lsb_release -cs) \ stable"
如果你是树莓派或其它ARM架构计算机,请运行: echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \ $(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list
最后安装 sudo apt-get update sudo apt-get install docker-ce
Ubuntu:
信任 Docker 的 GPG 公钥: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 对于 amd64 架构的计算机,添加软件仓库: sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable" 如果你是树莓派或其它ARM架构计算机,请运行: echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list 最后安装 sudo apt-get update sudo apt-get install docker-ce