1, 下载registry镜像

sudo docker pull registry

2, 启动镜像

docker run -d --name registry -h registry -p 5000:5000 --privileged=true -v /home/wenbronk/Downloads/docker/repository:/var/lib/registry registry

# 镜像中文件的保存位置, 刚开始没连接对..后来使用exec命令 进行find -name 查找到的

参数说明:
-v /opt/registry:/tmp/registry :默认情况下,会将仓库存放于容器内的/tmp/registry目录下,指定本地目录挂载到容器
–privileged=true
:CentOS7中的安全模块selinux把权限禁掉了,参数给容器加特权,不加上传镜像会报权限错误(OSError: [Errno 13]
Permission denied: ‘/tmp/registry/repositories/liibrary’)或者(Received
unexpected HTTP status: 500 Internal Server Error)错误

3, 修改一下镜像的tag

sudo docker tag busybox 192.168.1.110:5000/wenbronk/busybox

4, 将打了tag的image上传

docker push 192.168.1.117:5000/wenbronk/busybox

  注: 此处可能报错, 我的没有

Error: Invalid registry endpoint https://192.168.1.110:5000/v1/: Get https://192.168.112.136:5000/v1/_ping: dial tcp 192.168.112.136:5000: connection refused. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 192.168.112.136:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/192.168.112.136:5000/ca.crt

因为Docker从1.3.X之后默认docker registry使用的是https,所以当用docker pull命令下载远程镜像时,如果远程docker registry是非https的时候就会报上面的错误。为了解决这个问题需要在启动docker server时增加启动参数修改docker启动配置文件

vim /etc/sysconfig/docker

Ubuntu下配置文件地址为:/etc/init/docker.conf),增加启动选项(已有参数的在后面追加),之后重启docker

OPTIONS='--insecure-registry 192.168.1.110:5000'    #CentOS 7系统
other_args='--insecure-registry 192.168.1.110:5000' #CentOS 6系统

也可以使用nginx实现一个https链接

注: 此种方法可能不管用, 1.12.x以后没有该配置文件了

那么 在”/etc/docker/“目录下,创建”daemon.json“文件。在文件中写入:

{ "insecure-registries":["192.168.1.110:5000"] }

5, 因为Docker从1.3.X之后,与docker registry交互默认使用的是https,而此处搭建的私有仓库只提供http服务 在docker公共仓库下载一个镜像

docker push 192.168.0.110:/busybox

6, 查询仓库中的镜像

docker search 192.168.0.110:

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

  1. nexus3使用docker运行/创建docker私有仓库/maven私有仓库

    version: '3.2' services: nexus3: container_name: nexus3 hostname: nexus3 image: sonatype/nexus3:3.14 ...

  2. win10 下安装docker,创建镜像,push镜像到私有仓库,创建私有仓库,修改镜像仓库地址

    通过连接下载window docker安装文件,https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.ex ...

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

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

  4. docker 私有仓库镜像的存储位置

    docker 私有仓库的镜像 是存储在5739360d1030 registry "docker-registry" 3 days ago Up 28 hours 0.0.0.0: ...

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

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

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

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

  7. docker 私有仓库简易搭建

    概要 本地私有仓库 局域网私有仓库 总结 概要 docker hub 使用非常方便,而且上面有大量的镜像可以使用. 但是,每次都远程下载镜像速度非常慢,如果能在本地做一个 docker 的仓库,多人协 ...

  8. docker私有仓库-https+nginx

    一.概述 使用的是registry-2.4版本,因为在这个版本开始提供了garbage-collect,能够清理掉blobs,2.1开始提供了api的删除功能,但是只是删除的index并没有释放掉磁盘 ...

  9. docker 私有仓库 harbor docker-compose

    c创建docker私有仓库 docker pull registry:2.1.1 mkdir /opt/registry#mkdir /var/lib/registry docker run -d - ...

随机推荐

  1. [转载]HTML5游戏前端开发秘籍

    http://isux.tencent.com/html5-game-development-cheats.html 转载至腾讯ISUX HTML5游戏前端开发秘籍 本文由米随随编写 QQ空间Andr ...

  2. delphi中如何控制listview的每行的颜色

    我们可以设定一个字段的值,用以判断用什么颜色显示listview的颜色,例子如下 procedure TMainForm.ListView2CustomDrawItem(Sender: TCustom ...

  3. WinRT 中检查 WiFi 是否可用

    public static bool IsWifiConnected() { bool isWifiConnected = false; ConnectionProfile currentConnec ...

  4. LeetCode134:Gas Station

    题目: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. ...

  5. Android开发基于百度地图的乘车助手

    写在前面: 出去玩免不了挤公交.等地铁,不知道乘车方案当然不行,用官方APP吧,缺点一大堆,手机浏览器在线查的话既慢又麻烦...为了解决这些问题,我们来做一个简版的出行助手,嘛嘛再也不用担心我会迷路了 ...

  6. 为什么不能用Abort退出线程

    在使用线程时,如果线程还未结束直接退出线程很有可能会导致数据丢失. class threadAbort { static void Main(string[] args) { WriteMessage ...

  7. 基于C#语言MVC框架Aspose.Cells控件导出Excel表数据

    控件bin文件下载地址:https://download.csdn.net/download/u012949335/10610726 @{ ViewBag.Title = "xx" ...

  8. 如何用c#本地代码实现与Webbrowser中的JavaScript交互

    关键词:.Net,Webbrowser,JavaScript,communication 参考: 链接:msdn实例-简单的相互调用 代码: [PermissionSet(SecurityAction ...

  9. jzoj4724

    DJL为了避免成为一只咸鱼,来找czgj学习Fibonacci数列. 通过czgj的谆谆教导,DJL明白了Fibonacci数列是这样定义的: F(1)=1;F(2)=1;F(n)=F(n-1)+F( ...

  10. Alamofire源码导读五:错误表示

    AFError is the error type returned by Alamofire. It encompasses a few different types of errors, eac ...