简介
Docker中REGISTER仓库有些类似Maven的中央仓库.我们通过类似Git中的pull和push命令从REGISTER仓库中拉取镜像和推送镜像.
查找镜像
- 方式一
Docker Hub https://hub.docker.com/
- 方式二
- –no-trunc=false : 截断操作
- -s,–starts=0 : 每个镜像都会有star,我们可以通过-s操作来限定star数.
- 一次最多返回25条记录.
docker search [OPTIONS] TERM
拉取镜像
docker pull [OPTIONS] NAME [:TAG]
- -a, --all-tags=false :会把所有仓库中标记的镜像下载到本地中
- 示例:docker pull ubuntu:14.04
- 我们会发现我们拉取镜像的速度非常慢.我们可以修改REGISTER仓库的地址来加快下载的速度.
https://www.daocloud.io/mirror#accelerator-doc
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://a7775d97.m.daocloud.io
sudo systemctl restart docker
docker pull ubuntu:12.10
我们会发现明显速度已经提升很多了.
推送镜像:
docker push 镜像名.
- 步骤
- 1.注册hub的账号.
- 2.登陆hub的账号.docker login
- 3.使用push命令推送到hub中
docker push lanxw0720/commit_test1