知识基础:ubuntu系统安装,docker安装,了解docker的基础知识

下载镜像(如果下载2版本以上的需要配置ssl证书,这里先用0.9.1的演示)

root@ubuntu:/# docker pull registry:0.9.1

root@ubuntu:/# docker images
REPOSITORY  TAG   IMAGE ID   CREATED   VIRTUAL   SIZE

registry                         0.9.1               bdc26a966725        4 weeks ago          422.9 MB
csphere/ent                      0.1                 f9118a2c0edc        3 weeks ago          212.1 MB
root@ubuntu:/#

生成容器(用编程的术语说:将镜像实例化出一个容器)

端口号用5000,名称:registry  镜像文件和版本号:registry:0.9.1

root@ubuntu:/# docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:0.9.1

查看有哪些容器

root@ubuntu:/# docker ps –a

root@ubuntu:/# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9416c29b3cfd registry:0.9.1 "docker-registry" 45 minutes ago Up 14 minutes 0.0.0.0:5000->5000/tcp registry
root@ubuntu:/#

跳过,如果需要可删除没用的容器

root@ubuntu:/# docker rm –f 容器ID

用浏览器访问以下地址会出现一个弹出的下载窗口,证明私有仓库已安装好,后面是测试和修改配置步骤

http://172.16.160.32:5000

root@ubuntu:/# docker tag csphere/ent:0.1 172.16.160.32:5000/csphere/ent:0.1

修改docker的配置,不然push的时候会报错。

root@ubuntu:/# vi /etc/default/docker

添加以下内容到配置文件中:

DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=172.16.160.32:5000"

上传镜像到私有仓库

root@ubuntu:/# docker push 172.16.160.32:5000/csphere/ent

The push refers to a repository [172.16.160.32:5000/csphere/ent] (len: 1)

Sending image list

Pushing repository 172.16.160.32:5000/csphere/ent (1 tags)

f1b10cd84249: Image successfully pushed

172633e38420: Image successfully pushed

fab4b1df8eb1: Image successfully pushed

f9118a2c0edc: Image successfully pushed

Pushing tag for rev [f9118a2c0edc] on {http://172.16.160.32:5000/v1/repositories/csphere/ent/tags/0.1}

root@ubuntu:/#

查询私有仓库内的镜像

root@ubuntu:/#curl http://172.16.160.32:5000/v1/search

{"num_results": 1, "query": "", "results": [{"description": "", "name": "csphere/ent"}]}

root@ubuntu:/#

root@ubuntu:/# docker rmi 172.16.160.32:5000/csphere/ent:0.1
Untagged: 172.16.160.32:5000/csphere/ent:0.1
Deleted: f9118a2c0edcf4782c8100d29fafde29dfc3e16aa4c17f648bd9ef03f9b4a6a0
root@ubuntu:/#

下载前确认已经没有csphere/ent镜像文件

root@ubuntu:/# docker images

以下命令从172.16.160.32:5000上的csphere目录下下载版本号为0.1的ent镜像。

注:要指定IP地址不然会从公网上下载镜像,要指定版本,不然会提示找不到相应镜像。

root@ubuntu:/# docker pull 172.16.160.32:5000/csphere/ent:0.1
Pulling repository 172.16.160.32:5000/csphere/ent
f9118a2c0edc: Download complete
f1b10cd84249: Download complete
172633e38420: Download complete
fab4b1df8eb1: Download complete
Status: Downloaded newer image for 172.16.160.32:5000/csphere/ent:0.1
root@ubuntu:/#

下载后确认有csphere/ent镜像文件

root@ubuntu:/# docker images

错误示范:

root@ubuntu:/# docker pull 172.16.160.32:5000/csphere/ent
Pulling repository 172.16.160.32:5000/csphere/ent
FATA[0004] Tag latest not found in repository 172.16.160.32:5000/csphere/ent
root@ubuntu:/# curl http://172.16.160.32:5000/v1/search
{"num_results": 1, "query": "", "results": [{"description": "", "name": "csphere/ent"}]}root@ubuntu:/#
root@ubuntu:/# docker pull csphere/ent
Pulling repository csphere/ent
FATA[0020] Error: image csphere/ent:latest not found
root@ubuntu:/# docker pull csphere/ent:0.1
Pulling repository csphere/ent
FATA[0013] Error: image csphere/ent:0.1 not found

docker 私有仓库搭建的更多相关文章

  1. CentOS7 Docker私有仓库搭建及删除镜像 【转】

    文章来源:centos7 Docker私有仓库搭建及删除镜像 如果不想用私有镜像库,你可以用docker的库 https://hub.docker.com 环境准备 环境:两个装有Docker 17. ...

  2. Docker学习笔记 — Docker私有仓库搭建

    Docker学习笔记 — Docker私有仓库搭建   目录(?)[-] 环境准备 搭建私有仓库 测试 管理仓库中的镜像 查询 删除 Registry V2   和Mavan的管理一样,Dockers ...

  3. docker私有仓库搭建(ubuntu 14.04和centos7)

    最近是在做一个关于docker云化的项目,马上就要开始实战.下午先做了一个私有仓库搭建的实验,先大概做个笔记,有兴趣的蛮看一下吧. 先在所有机子上都安装上docker,我的是两台ubuntu,分别是1 ...

  4. Docker学习笔记 — Docker私有仓库搭建【转载】

    标签: Docker 2015-03-10 21:08 24190人阅读 评论(0) 收藏 举报  分类: Docker(26)    目录(?)[+]   和Mavan的管理一样,Dockers不仅 ...

  5. CentOS环境下Docker私有仓库搭建

    本文讲述如何搭建docker私有仓库. 有了docker hub,为什么还要搭建docker私有仓库? 1.性能考虑:docker hub的访问要通过互联网,性能太低. 2.安全性:更多的时候,镜像不 ...

  6. docker私有仓库搭建和资源限制

    Docker 私有仓库的搭建 docker 私有仓库默认只支持https协议的访问  不支持http协议 如果需要允许通过http协议访问 必须手动修改配置文件 docker官方默认提供的仓库  提供 ...

  7. centos7 docker私有仓库搭建

    习Docker的过程中Docker的私有仓库一直没能成功,就是因为CentOS 6.x和CentOS 7默认引入了支持https认证,每次在push和pull的时候都会报错,今天是周末,利用一天的时间 ...

  8. docker私有仓库搭建及认证

    什么是docker? Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机 ...

  9. Docker私有仓库搭建

    # 环境 系统 Linux 3.10.0-123.9.3.el7.x86_64 CentOS 7.0.1406 (Core) Docker 1.12.0, build 8eab29e 1.获取镜像 私 ...

随机推荐

  1. button按钮点击不刷新(前端交流学习:452892873)

    <button type="button" value="test" >确认买单</button> 可实现页面点击不刷新效果

  2. 画地为Mask,随心所欲的高效遮罩组件[Unity]

    在上一篇博文"扔掉遮罩,更好的圆形Image组件"中,笔者改变Image的顶点数据,使得Image呈圆形显示,避免了Mask的使用,从而节省Drawcall消耗,提高渲染效率了.这 ...

  3. UISement属性

    .segmentedControlStyle 设置segment的显示样式. typedef NS_ENUM(NSInteger, UISegmentedControlStyle) { UISegme ...

  4. Thinkphp3.2学习——架构_URL模式

    入口文件是应用的单一入口,对应用的所有请求都定向到应用入口文件,系统会从URL参数中解析当前请求的模块.控制器和操作: http://serverName/index.php/模块/控制器/操作 这是 ...

  5. MyEclipse2016统一字符编码

    MyEclipse一般没做修改,默认的字符编码是GBK,但是在实际的开发中常用的是utf-8,为了避免出现乱码等情况,我们需要把开发工具的编码都统一设置成utf-8,修改步骤如下: 1.打开MyEcl ...

  6. angular.js的时间指令

    最后样式 html .input-group(style="max-width:150px") input.form-control(uib-datepicker-popup=&q ...

  7. Cisco Packet Tracer做单臂路由的过程

    Cisco Packet Tracer版本:6.0.0.0045 单臂路由 VLAN规划 switch 0上配置:Switch>enSwitch(config)#vlan 2 #创建vlan2S ...

  8. SpringMVC中使用@Value给非String类型注入值

    String类型的@Value注入方式 String类型的直接可以使用 @Value("陈婉清") private String name; 非String类型的@Value注入方 ...

  9. VFP 实验参考答案

    1.    使用for循环计算1到1000之间能既能被7整除也能被11整除的所有的数的和.(结果为6006)源程序代码 sum=0 i=1 for i=1 to 1000 if((i%7=0) and ...

  10. Java基础知识二次学习--第八章 流

    第八章 流   时间:2017年4月28日11:03:07~2017年4月28日11:41:54 章节:08章_01节 视频长度:21:15 内容:IO初步 心得: 所有的流在java.io包里面 定 ...