复习(mianshi)实验-
[root@hui ~]# systemctl restart docker
[root@hui ~]# yum info docker-reistry
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
错误:没有匹配的软件包可以列出
[root@hui ~]# yum info docker-registry
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
可安装的软件包
名称 :docker-registry
架构 :x86_64
版本 :0.9.1
发布 :7.el7
大小 :123 k
源 :extras/7/x86_64
简介 : Registry server for Docker
网址 :https://github.com/docker/docker-registry
协议 : ASL 2.0
描述 : Registry server for Docker (hosting/delivering of repositories and
: images).
[root@hui ~]# yum install docker-registry
已加载插件:fastestmirror, langpacks
base | 3.6 kB 00:00
centos7 | 3.6 kB 00:00
docker-ce-stable | 2.9 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
Loading mirror speeds from cached hostfile
软件包 docker-registry 已经被 docker-distribution 取代,改为尝试安装 docker-distribution-2.6.2-2.git48294d9.el7.x86_64
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-distribution.x86_64.0.2.6.2-2.git48294d9.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
===============================================================================
Package 架构 版本 源 大小
===============================================================================
正在安装:
docker-distribution x86_64 2.6.2-2.git48294d9.el7 extras 3.5 M
事务概要
===============================================================================
安装 1 软件包
总下载量:3.5 M
安装大小:12 M
Is this ok [y/d/N]: y
Downloading packages:
docker-distribution-2.6.2-2.git48294d9.el7.x86_64.rpm | 3.5 MB 00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : docker-distribution-2.6.2-2.git48294d9.el7.x86_64 1/1
验证中 : docker-distribution-2.6.2-2.git48294d9.el7.x86_64 1/1
已安装:
docker-distribution.x86_64 0:2.6.2-2.git48294d9.el7
完毕!
[root@hui ~]# rpm -ql docker-distribution
/etc/docker-distribution/registry/config.yml 主配置文件
/usr/bin/registry
/usr/lib/systemd/system/docker-distribution.service
/usr/share/doc/docker-distribution-2.6.2
/usr/share/doc/docker-distribution-2.6.2/AUTHORS
/usr/share/doc/docker-distribution-2.6.2/CONTRIBUTING.md
/usr/share/doc/docker-distribution-2.6.2/LICENSE
/usr/share/doc/docker-distribution-2.6.2/MAINTAINERS
/usr/share/doc/docker-distribution-2.6.2/README.md
/var/lib/registry 上传镜像所在的位置,我们可以 通过主文件修改,规划目录的大小,毕竟上传镜像需要的空间很大
vim /etc/docker-distribution/registry/config.yml
version: 0.1
log:
fields:
service: registry
storage:
cache:
layerinfo: inmemory 所有的缓存放在内存中
filesystem:
rootdirectory: /var/lib/registry 镜像目录
http:
addr: :5000 没有写地址,说明是本机的所有可用地址
[root@hui registry]# systemctl start docker-distribution
[root@hui registry]# netstat -tnl 5000端口
准备推送仓库:
1、打标签:
将镜像myweb:v0.3-11 打标为:node02.magedu.com:5000/myweb:v0.3-11
另外一台主机名端口号 一级顶级仓库

2、推送镜像

发现报错,因为docker不支持http协议,只支持https
在私网中怎么解决:
我们需要在配置文件中标记问非加密非安全
# vim /etc/docker/daemon.json

#systemctl restart docker
#docker push node02.magedu.com:5000/myweb:v0.3-11
3、查看镜像并pull镜像:
在node02.magedu.com主机上:
#cd /var/lib/registry
#ls
# vim /etc/docker/daemon.json

#systemctl restart docker

浙公网安备 33010602011771号