Centos7 创建本地 docker 仓库极其遇到的问题
环境安装:
- VirtualBox 安装 Centos7
- 安装 docker
1. 配置私有仓库和客户端地址
私有仓库:192.168.1.104
客户端:192.168.1.103
通过 Centos 指令: yum install docker 在两台计算机中安装 docker ,可通过docker --version查看相应版本,如:
[root@localhost docker]# docker --version
Docker version 1.12.6, build 88a4867/1.12.6
注意:
- 虚拟机的网络设置一定要选 桥接网卡
- Window 的 IP 为:192.168.1.101,保证192.168.1.101、192.168.1.103、192.168.1.104三者均能互相 ping 通
2. 创建私有仓库(在192.168.1.104虚拟机下)
启动docker服务:
service docker start下载创建私有仓库的registry镜像:
docker pull registry下载上传到私有仓库的镜像,这里选用ubuntu:
docker pull ubuntu查看拥有的image:
[root@localhost docker]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/registry latest 3ebefe7c539b 3 days ago 33.19 MB docker.io/ubuntu 14.04 d5b7370807f9 4 days ago 188 MB创建私有仓库:
docker run -p 5000:5000 docker.io/registry标记 tag 为 d5b7 的 image :
docker tag d5b7 192.168.1.104:5000/shy
其中 192.168.1.104 为虚拟机 IP 、 5000 为开启的端口号、 shy 为自己指定的名称。再次使用
docker images查看 image ,发现多了一项:
192.168.1.104:5000/shy latest d5b7370807f9 4 days ago 188 MB推送 192.168.1.104:5000/shy 至本地仓库,此时推送不成功:
[root@localhost sysconfig]# docker push 192.168.1.104:5000/shy The push refers to a repository [192.168.1.104:5000/shy] Get https://192.168.1.104:5000/v1/_ping: http: server gave HTTP response to HTTPS client网上很多解决方式为:
[root@localhost ~]# vim /etc/sysconfig/docker
修改
OPTIONS='--insecure-registry 192.168.1.104:5000'
重启 docker :
[root@localhost ~]# service docker restart
尝试之后并没有效果。
正确的解决方式:
[root@localhost docker]# vim /etc/docker/daemon.json
加入:
{"insecure-registries":["192.168.1.104:5000"]}
这句指令表示信任此私有仓库。
重启 docker 。
重新推送 192.168.1.104:5000/shy 至本地仓库:
[root@localhost docker]# docker push 192.168.1.104:5000/shy The push refers to a repository [192.168.1.104:5000/shy] 66de4e1063cf: Pushed e9c9caa1b034: Pushed d787e686c79f: Pushed bbad1fb7434a: Pushed 826fc2344fbb: Pushed latest: digest: sha256:2c2577062577c5d58af7cc6ac168b6dbaa6f4b5d32da07728435a06a61ad7c66 size: 1359查看是否推送成功:
[root@localhost docker]# curl http://192.168.1.104:5000/v2/shy/tags/list {"name":"shy","tags":["latest"]}
输出这个表示推送成功,可以在 192.168.1.103 上下载。
2. 客户端下载私有仓库的 image (在 192.168.1.103 虚拟机下)
启动 docker
使用命令 pull 下载:
[root@localhost shihuayun]# docker pull 192.168.1.104:5000/shy Using default tag: latest Trying to pull repository 192.168.1.104:5000/shy ... Get https://192.168.1.104:5000/v1/_ping: http: server gave HTTP response to HTTPS client
此时下载出错,同样的原因,在 192.168.1.103 虚拟机下:
[root@localhost shihuayun]# vim /etc/docker/daemon.json
加入:
{"insecure-registries":["192.168.1.104:5000"]}
重启 docker 。重新下载:
[root@localhost docker]# docker pull 192.168.1.104:5000/shy Using default tag: latest Trying to pull repository 192.168.1.104:5000/shy ... latest: Pulling from 192.168.1.104:5000/shy 48f0413f904d: Pull complete 87474b8d0f4c: Pull complete 2b6baf792196: Pull complete 4dccbbb76bce: Pull complete fba30d3e45c8: Pull complete Digest: sha256:2c2577062577c5d58af7cc6ac168b6dbaa6f4b5d32da07728435a06a61ad7c66
此时成功下载。查看本地 images :
[root@localhost docker]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.1.104:5000/shy latest d5b7370807f9 4 days ago 188 MB
[1]: http://docs.docker.com/
[2]: 杨保华、戴王剑、曹亚伦编著, Docker 技术入门与实战
[3]: http://blog.csdn.net/qq_29145989/article/details/53738280http://blog.csdn.net/qq_29145989/article/details/53738280
[4]: http://blog.csdn.net/wangtaoking1/article/details/44180901/http://blog.csdn.net/wangtaoking1/article/details/44180901/
Centos7 创建本地 docker 仓库极其遇到的问题的更多相关文章
- 关于创建本地docker仓库
从远程仓库中下载regitstry镜像文件,下载后运行命令即可:docker run -p 5000:5000 -d registry
- CentOS7创建本地YUM源的三种方法
这篇文章主要介绍了CentOS7创建本地YUM源的三种方法,本文讲解了使用CentOS光盘作为本地yum源.如何为CentOS创建公共镜像.创建完全自定义的本地源等内容,需要的朋友可以参考下 ...
- git怎么创建本地版本仓库
git怎么创建本地版本仓库 安装git我就不用说了吧!下载地址:https://github.com/msysgit/msysgit/releases/download/Git-1.9.4-previ ...
- CentOS7搭建本地YUM仓库,并定期同步阿里云源
CentOS7同步阿里云镜像rpm包并自建本地yum仓库 系统环境 # cat /etc/centos-release CentOS Linux release 7.6.1810 (Core) # u ...
- repodata创建本地YUM仓库
参考一createrepo是linux下的创建仓库的软件包.create是创建的意思,repo是repository的缩写,是仓库的意思. yum(Yellow dog Updater,Modifie ...
- k8s 创建私有docker仓库 登陆授权令牌的Secret
参考https://kubernetes.io/zh/docs/tasks/configure-pod-container/pull-image-private-registry/ Kubernete ...
- centos创建本地yum仓库
怎样发布自己软件的安装和更新YUM源 在创建之前,我们先了解些相关的内容: yum仓库可以支持三种途径提供给yum在安装的时候下载rpm包 第一种: ftp服务 ftp:// 第二种: http ...
- CentOS7创建本地源过程
1)使用yum安装http服务(主节点) yum -y install httpd 2)将httpd服务加入系统自启动服务并设置开机启动 systemctl start httpd #启动apache ...
- CentOS7创建本地yum源
[root@master ~]# mkdir -p /var/www/html 使用安装系统的ISO镜像文件CentOS-7-x86_64-Everything-1611.iso 把CentOS-7- ...
随机推荐
- Cognos 11.0快速开发指南 Ⅱ
1. 创建报表 在创建好数据源之后,我们就可以创建报表了,报表的开发是浏览器中完成的,这里我选用了chrome浏览器,在地址栏输入:http://localhost:80/ibmcognos ( ...
- fileZilla 设置 记录一笔 以防忘记
- 带你走进SAP项目实施过程——立项(1)
到底谁会首先有上ERP的想法,可能是企业老板,也可能是总经理级别等高管.但不管是谁,在确定之前,按道理企业风控部.总经办或者信息部等相关部门都需要对ERP项目做立项申请.毕竟ERP项目涉及企业方方面面 ...
- 自动化测试:behave
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- RAISERROR
RAISERROR 可以抛出一个错误,并被程序捕获,在存储过程经常使用: 是否进入Catch代码执行区域,在于错误严重等级设置 RAISERROR ('无效数据', 11 , 1) 第一个参数:自定义 ...
- [ASP.NET MVC]笔记(二) 数据注解和验证
验证注解的使用 1.Required:必须字段 [Required] public string FirstName() { get; set; } 2.StringLength:长度限制,或是可选项 ...
- IT经典书籍——Head First系列…
Head First 系列书籍是由 O'Relly 出版社发行的一系列教育书籍,中文一般翻译为"深入浅出",它强调以特殊的方式排版,由大量的图片和有趣的内容组合构成,而达到非疲劳的 ...
- [转载]python 详解re模块
原文地址:python 详解re模块作者:Rocky 正则表达式的元字符有. ^ $ * ? { [ ] | ( ) .表示任意字符 []用来匹配一个指定的字符类别,所谓的字符类别就是你想匹配的一个字 ...
- 在对话框中利用CToolBar类添加工具条的方法
UINT BASED_CODE DockTool[]={ID_NEWGAME,ID_SAVE,ID_OPEN,ID_SEPARATOR,ID_COPYFEN,ID_PASTEFEN,ID_SEPARA ...
- Beta版本冲刺前期计划及安排
a. 介绍小组新加入的成员,Ta担任的角色. 吴东益:经讨论决定,Ta担任角色为开发人员 李志霖:在原先的团队中负责前端开发与界面设计.现经讨论决定,Ta此次担任角色为开发人员 由他们替代原来成员陈雄 ...