仓库与注册服务器

仓库(Repository)集中存放镜像的项目或目录。

注册服务器(Registry)管理仓库的服务器,服务器上可以有多个仓库,每个仓库有多个镜像。

例如:在仓库地址docker.io/ubuntu中,docker.io是注册服务器地址, ubuntu是仓库名。

Docker Hub

Docker Hub是Docker官方维护的公共仓库。

网页登录Docker Hub,可以创建和删除docker用户的仓库和镜像。

Docker国内镜像的配置及使用

配置DaoCloud的Docker加速器(国内registry-mirror)

官方镜像与用户镜像

官方镜像(OFFICIAL)是基础或根镜像,由Docker公司创建、验证、支持、提供,使用单个单词作为名字,例如docker.io/centos

用户镜像是由Docker用户创建并维护,以用户名称作为前缀,例如docker.io/anliven/hello-world

自动创建

Docker Hub的自动创建(Automated Builds)功能可以跟踪GitHub等网站的项目,自动根据项目的变化执行创建。

配置自动创建之后,可以在Docker Hub的自动创建页面中跟踪每次创建的状态。

  1. 创建并登录 Docker Hub,以及目标网站;
  2. 在目标网站中连接帐户到 Docker Hub;
  3. 在 Docker Hub 中 配置一个自动创建;
  4. 选取一个目标网站中的项目( 需要含 Dockerfile) 和分支;
  5. 指定 Dockerfile 的位置,并提交创建。

常用命令

docker images  # 查看本地镜像
docker search # 查找仓库中的镜像
docker pull # 下载仓库中的镜像到本地
docker login # 登录Docker registry
docker push # 推送镜像到Docker registry

示例:docker search 和 docker pull

[root@CentOS-7 ~]# docker images ubuntu
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/ubuntu latest 6a2f32de169d 2 weeks ago 117.2 MB
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker search ubuntu
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/ubuntu Ubuntu is a Debian-based Linux operating s... 5919 [OK]
docker.io docker.io/rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 81 [OK]
docker.io docker.io/ubuntu-upstart Upstart is an event-based replacement for ... 71 [OK]
docker.io docker.io/ubuntu-debootstrap debootstrap --variant=minbase --components... 30 [OK]
docker.io docker.io/torusware/speedus-ubuntu Always updated official Ubuntu docker imag... 27 [OK] [OK]
......
......
......
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker pull ubuntu:14.04
Trying to pull repository docker.io/library/ubuntu ...
14.04: Pulling from docker.io/library/ubuntu
8f229c550c2e: Pull complete
8e1fb71e8df6: Pull complete
f75a34586856: Pull complete
8744e322b832: Pull complete
d5165bfce78f: Pull complete
Digest: sha256:edf05697d8ea17028a69726b4b450ad48da8b29884cd640fec950c904bfb50ce
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker images ubuntu
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/ubuntu latest 6a2f32de169d 2 weeks ago 117.2 MB
docker.io/ubuntu 14.04 302fa07d8117 2 weeks ago 188 MB
[root@CentOS-7 ~]#

示例:docker login

[root@CentOS-7 ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: anliven
Password:
Login Succeeded
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# ls -la |grep docker
drwx------ 2 root root 24 Apr 28 10:32 .docker
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# ls -la .docker # 本地用户目录的.docker中将保存相关认证信息。
total 8
drwx------ 2 root root 24 Apr 28 10:32 .
dr-xr-x---. 18 root root 4096 Apr 28 10:32 ..
-rw------- 1 root root 99 Apr 28 10:32 config.json
[root@CentOS-7 ~]#

示例:docker push

[root@CentOS-7 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/hello-world latest 48b5124b2768 3 months ago 1.84 kB
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker tag 48b5124b2768 anliven/hello-world:test
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
anliven/hello-world test 48b5124b2768 3 months ago 1.84 kB
docker.io/hello-world latest 48b5124b2768 3 months ago 1.84 kB
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker push anliven/hello-world
The push refers to a repository [docker.io/anliven/hello-world]
98c944e98de8: Mounted from library/hello-world
test: digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 size: 524
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker search anliven/hello-world
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/anliven/hello-world 0
[root@CentOS-7 ~]#

Docker - 访问仓库的更多相关文章

  1. 一步步搭建docker私有仓库并从私有仓库中下载镜像

    一步步搭建docker私有仓库 #下载镜像 docker pull registry#查看镜像 docker images #运行私有仓库,指定端口和数据卷 docker run -d -p : -v ...

  2. 搭建docker私有仓库,建立k8s集群

    服务器IP角色分布 192.168.5.2 etcd server 192.168.5.2 kubernetes master 192.168.5.3 kubernetes node 192.168. ...

  3. docker 镜像仓库 Harbor 部署 以及 跨数据复制

    docker 镜像仓库 Harbor 部署 跨数据复制 Harbor 是 Vmwar 公司开源的 企业级的 Docker Registry 管理项目 它主要 提供 Dcoker Registry 管理 ...

  4. 转载:教你分分钟搞定Docker私有仓库Registry

    一.什么是Docker私有仓库Registry 官方的Docker hub是一个用于管理公共镜像的好地方,我们可以在上面找到我们想要的镜像,也可以把我们自己的镜像推送上去.但是,有时候我们的服务器无法 ...

  5. <二>企业级开源仓库nexus3实战应用–使用nexus3配置docker私有仓库

    1,安装nexus3. 这个地方略了,安装部署可以参考:nexus3安装配置. 2,配置走起. 1,创建blob存储. 登陆之后,先创建一个用于存储镜像的空间. 定义一个name,下边的内容会自动补全 ...

  6. Docker 私有仓库建立(加密和用户验证)

    (一)生成证书1.mkdir /certs2.cd /certs 3.生成自签名证书 sudo openssl req -newkey rsa:2048 -new -nodes -x509 -days ...

  7. 搭建docker私有仓库(https)

    1.修改openssl.cnf,支持IP地址方式,HTTPS访问在Redhat7或者Centos系统中,文件所在位置是/etc/pki/tls/openssl.cnf.在其中的[ v3_ca]部分,添 ...

  8. 搭建docker私有仓库

    保存镜像的地方成为仓库(registry).目前有2种仓库:公共仓库和私有仓库. 最方便的是使用公共仓库上传和下载镜像,下载不需要注册,上传需要到公共仓库注册.公共仓库网站:https://hub.d ...

  9. 离线手动部署docker镜像仓库——harbor仓库(HTTPS)

    实验环境: harbor服务器系统:CentOS Linux release 7.5.1804 (Core)harbor服务器IP:10.1.12.114harbor版本:v1.5.0docker版本 ...

随机推荐

  1. eclipse中代码格式化组合键失效了

    因为最近在整理java笔记,发现代码格式化的组合键失效了,但其他的组合键是好着的,设置里面找了也是对着的. 最后是在输入法的设置里面发现了它,原来是快捷键冲突了.取消输入法里面 的快捷键就好了,或者改 ...

  2. 开始学习yii2第一天

    今天在朋友圈看到一条转发,内容是根据招聘网站的要求,列举了需要一个php工程师具体需要哪些技能 框架要求是yii2 出现的最多 已经出来工作了快半个月了,感觉工资还是少的可怜,而且我也好想去张江, 所 ...

  3. 2.Java集合总结系列:List接口及其实现

    在介绍List接口之前,我们先来看看 Collection 接口,因为Collection接口是 List / Set / Queue 接口的父接口,List / Set / Queue 的实现类中很 ...

  4. 3.Maven坐标和依赖

    1.1 何为Maven坐标 正如之前所说的,Maven的一大功能就是管理项目依赖.为了能自动化地解析任何一个Java构件,Maven就必须将它们唯一标识,这就依赖管理的底层基础——坐标. 1.2 坐标 ...

  5. AngularJS1.X学习笔记6-控制器和作用域

    经过一番艰苦卓绝的鏖战,我终于来到了控制器和作用域部分.控制器作为MVC的C,其重要性不可谓不重要:作用域决定了你可以拿到哪些东西,亦是分外重要.现在就来学习一下两个东西.去看看$apply,$wat ...

  6. C# CodeFirst编程模型一

    定义实体类型: 定义两个实体Menu和MenuCard,一个menu关联一个menucard,menucard包含对所有menu的引用. public class Menu { public int ...

  7. 关于constraint的用法

    1.主键约束:要对一个列加主键约束的话,这列就必须要满足的条件就是非空因为主键约束:就是对一个列进行了约束,约束为(非空.不重复)以下是代码  要对一个列加主键,列名为id,表名为emp格式为:alt ...

  8. FPGA中将十进制数在数码管中显示(verilog版)--二进制转换为BCD码

    这周有朋友问怎样在fpga中用数码管来显示一个十进制数,比如1000.每个数码管上显示一位十进制数.如果用高级语言来分离各位,只需要分别对该数做1000,100,10对应的取商和取余即可分离出千百十个 ...

  9. input标签禁止输入,隐藏光标

    <INPUT class=""  value="" name= "" readonly onfocus="this.blur ...

  10. openMP编程(上篇)之指令和锁

    openMP简介 openMP是一个编译器指令和库函数的集合,主要是为共享式存储计算机上的并行程序设计使用的. 当计算机升级到多核时,程序中创建的线程数量需要随CPU核数变化,如在CPU核数超过线程数 ...