第一步:拉取registry镜像

[root@localhost iso]# docker image pull registry
Using default tag: latest
latest: Pulling from library/registry
c87736221ed0: Pull complete
1cc8e0bb44df: Pull complete
54d33bcb37f5: Pull complete
e8afc091c171: Pull complete
b4541f6d3db6: Pull complete
Digest: sha256:8004747f1e8cd820a148fb7499d71a76d45ff66bac6a29129bfdbfdc0154d146
Status: Downloaded newer image for registry:latest
docker.io/library/registry:latest

第二步:查看镜像构建历史信息

[root@localhost iso]# docker image history registry
IMAGE CREATED CREATED BY SIZE COMMENT
f32a97de94e1 8 months ago /bin/sh -c #(nop) CMD ["/etc/docker/registr… 0B
<missing> 8 months ago /bin/sh -c #(nop) ENTRYPOINT ["/entrypoint.… 0B
<missing> 8 months ago /bin/sh -c #(nop) COPY file:507caa54f88c1f38… 155B
<missing> 8 months ago /bin/sh -c #(nop) EXPOSE 5000 0B
<missing> 8 months ago /bin/sh -c #(nop) VOLUME [/var/lib/registry] 0B
<missing> 8 months ago /bin/sh -c #(nop) COPY file:4544cc1555469403… 295B
<missing> 8 months ago /bin/sh -c #(nop) COPY file:21256ff7df5369f7… 20.1MB
<missing> 8 months ago /bin/sh -c set -ex && apk add --no-cache… 1.29MB
<missing> 8 months ago /bin/sh -c #(nop) CMD ["/bin/sh"] 0B
<missing> 8 months ago /bin/sh -c #(nop) ADD file:38bc6b51693b13d84… 4.41MB

第三步:启动容器

[root@localhost ~]# docker run --name refistry -d -p 8878:5000 -v /registry:/var/lib/registry registry
c2da1e4739006621455c09f1c319e67a063350b050d8cc4c07257b898a7536ce
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c2da1e473900 registry "/entrypoint.sh /etc…" 50 seconds ago Up 50 seconds 0.0.0.0:8878->5000/tcp refistry

第四步:镜像改名

[root@localhost ~]# docker tag httpd 192.168.59.200:8878/http:test
[root@localhost ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest f32a97de94e1 8 months ago 25.8MB
192.168.59.200:8878/http test fb2f3851a971 18 months ago 178MB
httpd latest fb2f3851a971 18 months ago 178MB

第五步:修改docker文件并重启

[root@localhost docker]# vim daemon.json
{
"registry-mirrors": ["https://XXX.mirror.aliyuncs.com"],
"insecure-registries": ["192.168.59.200:8878"]
}
[root@localhost docker]# systemctl restart docker

'''
原因:

[root@localhost ~]# docker image push 192.168.59.200:8878/http
The push refers to repository [192.168.59.200:8878/http]
Get https://192.168.59.200:8878/v2/: http: server gave HTTP response to HTTPS client

'''

第六步:重启registry容器

[root@localhost docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c2da1e473900 registry "/entrypoint.sh /etc…" 12 minutes ago Exited (2) About a minute ago refistry
0400349ee7c8 httpd "httpd-foreground" 53 minutes ago Exited (0) About a minute ago httpd-test2
e60cdf12daa7 httpd "httpd-foreground" About an hour ago Exited (0) About a minute ago http-test
391afba79c84 httpd "httpd-foreground" About an hour ago Exited (0) About a minute ago httpd
9225fd6da0e2 tomcat:test "catalina.sh run" 2 hours ago Exited (143) About a minute ago tomcat
[root@localhost docker]# docker restart c2da1e473900

第七步:推送

[root@localhost docker]# docker image push 192.168.59.200:8878/http
The push refers to repository [192.168.59.200:8878/http]
0f8d971d177b: Pushed
97fd31ecd005: Pushed
82155933cfa6: Pushed
2fd9f57029b0: Pushed
02bd518ef304: Pushed
b8342f9976fc: Pushed
2c833f307fd8: Pushed
test: digest: sha256:58270ec746bed598ec109aef58d495fca80ee0a89f520bd2430c259ed31ee144 size: 1780
[root@localhost docker]#

第八步:查找本地库

[root@localhost docker]# docker container inspect c2da1e473900|grep -i "source"
"Source": "/registry",
[root@localhost repositories]# cd
[root@localhost ~]# cd /registry/docker/registry/v2/repositories
[root@localhost repositories]# ls
http
[root@localhost repositories]#

附加:

删除镜像

[root@localhost ~]# docker image rm 192.168.59.200:8878/http

拉取镜像:

[root@localhost ~]# docker pull 192.168.59.200:8878/http

docker搭建本地registry的更多相关文章

  1. Docker 搭建本地Registry

    Docker已经将Registry开源,Registry本身也是一个容器. 1. 修改配置/etc/docker/daemon.json,去掉docker默认的https的访问   里面的内容是一个j ...

  2. 搭建本地 Registry - 每天5分钟玩转 Docker 容器技术(20)

    Docker Hub 虽然非常方便,但还是有些限制,比如: 需要 internet 连接,而且下载和上传速度慢. 上传到 Docker Hub 的镜像任何人都能够访问,虽然可以用私有 reposito ...

  3. 020、搭建本地Registry(2019-01-11 周五)

    参考https://www.cnblogs.com/CloudMan6/p/6902325.html   Docker Hub 虽然方便,但还是有些限制,比如     1.需要Internet连接,上 ...

  4. 第 3 章 镜像 - 020 - 搭建本地 Registry

    Docker Hub 虽然非常方便,但还是有些限制,比如: 需要 internet 连接,而且下载和上传速度慢. 上传到 Docker Hub 的镜像任何人都能够访问,虽然可以用私有 reposito ...

  5. 利用Docker搭建本地https环境的完整步骤

    利用Docker搭建本地https环境的完整步骤 这篇文章主要给大家介绍了关于如何利用Docker搭建本地https环境的完整步骤,文中通过示例代码将实现的步骤介绍的非常详细,对大家的学习或者工作具有 ...

  6. docker 笔记 (6)搭建本地registry

    转:http://blog.csdn.net/felix_yujing/article/details/51564739 新版 registry v2对镜像存储格式进行了重新设计,并且和旧版还不兼容. ...

  7. docker搭建本地仓库并制作自己的镜像

    原文地址https://blog.csdn.net/junmoxi/article/details/80004796 1. 搭建本地仓库1.1 下载仓库镜像1.2 启动仓库容器2. 在CentOS容器 ...

  8. docker搭建私有registry

    搭建docker的私有registry 1.   registry简介 Docker在2015年推出了distribution项目,即Docker Registry 2.相比于old registry ...

  9. Docker搭建本地私有仓库

    安装部署一个私有的Docker Registry是引入.学习和使用Docker这门技术的必经之路之一.尤其是当Docker被所在组织接受,更多人.项目和产品开始接触和使用Docker时,存储和分发自制 ...

随机推荐

  1. [ZJOI2006]物流运输trans

    Description 物流公司要把一批货物从码头A运到码头B.由于货物量比较大,需要n天才能运完.货物运输过程中一般要转停好几个码头.物流公司通常会设计一条固定的运输路线,以便对整个运输过程实施严格 ...

  2. Huffman树及其编解码

    Huffman树--编解码 介绍:   Huffman树可以根据输入的字符串中某个字符出现的次数来给某个字符设定一个权值,然后可以根据权值的大小给一个给定的字符串编码,或者对一串编码进行解码,可以用于 ...

  3. python urllib2实现http GET PUT DELETE POST的方法

    #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/11 下午8:33 # @Author : liubing # @File ...

  4. django安装以及配置

    一.django的安装和启动 1.安装 pip3 install django==1.11.22 目前来讲1.11.22版本比较稳定 2.django的创建 命令行:cmd先去到django创建目录, ...

  5. 就个人银行账户管理程序谈谈C++和Java的异同

    4_9 同: Java和C++都是面向对象的语言.都有数据成员,方法,访问权限的概念. 异: 访问权限上,非private时Java的默认访问权限是包.而C++的默认访问权限是private.Java ...

  6. Python_函数做字典的值

    当需要用到3个及以上的if...elif...else时就要考虑该方法进行简化 通过将函数名称当做字典的值,利用字典的关键字查询,可以快速定位函数,进行执行 [场景]用户查询信息,输入fn查询,执行对 ...

  7. 渗透-简单制作过waf的中国菜刀

    0x01 简单分析 web渗透中很常见的情况,用菜刀连接免杀的一句话木马连不上,有waf 除了变形一句话木马为免杀一句话,我们还需要来制作过waf的菜刀进行连接. 这里用的一句话为 来看看菜刀连接一句 ...

  8. [Luogu3868] [TJOI2009]猜数字

    题目描述 现有两组数字,每组k个,第一组中的数字分别为:a1,a2,...,ak表示,第二组中的数字分别用b1,b2,...,bk表示.其中第二组中的数字是两两互素的.求最小的非负整数n,满足对于任意 ...

  9. [POJ2356] Find a multiple 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8776   Accepted: 3791   ...

  10. linux-pclint代码检测

    win10.ubuntu16.04, vs2017. 1.安装pc-lint到C盘. 2.将linux下的usr整个目录打包拷贝到win10某盘下. 3.获取lint检测linux c++ 代码的宏参 ...