docker registry 和registry-ui 整合的问题

自己动手搭建registary私服。 <span style="font-size:16px">1. 从官方pull了registry镜像,通过下面的方式启动</span> <pre> docker run -d -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v /opt/data/registry:/tmp/registry -p 5000:5000 registry </pre> 通过 <pre> docker ps </pre> 查看,启动成功 <pre> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 77b362c26641 registry "docker-registry" 5 seconds ago Up 3 seconds 0.0.0.0:5000->5000/tcp focused_yalow </pre> 命令行输入 <pre> curl localhost:5000/v1/registry </pre> 显示如下信息,证明启动成功 <pre> "\"docker-registry server\"" </pre> 查看/opt/data/registry/repository 挂载成功 <pre> tree /opt/data/registry/repositories/ /opt/data/registry/repositories/ ├── library │   └── my_nodejs_image │   ├── _index_images │   ├── json │   ├── tag_latest │   └── taglatest_json └── linfeng └── cmd ├── _index_images ├── tag_0.1 └── tag0.1_json 4 directories, 7 files </pre> <span style="font-size:16px">2. 接下来启动registry-ui</span> <pre> docker run -d --name docker-webui -p ip:8080:8080 atcol/docker-registry-ui </pre> <span style="font-size:16px">3. 然后我输入地址`http://ip:8080` </span> 证实image启动成功 <span style="font-size:16px">4. 添加主机地址 但是总是显示ping失败</span> 失败原因是因为没有在防火墙中加入访问规则: `vim /etc/sysconfig/iptables` 添加下面一行: <pre> -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT </pre> 重启防火墙`service iptables restart`,访问成功
已邀请:

jeffsui - 奔四的双鱼座,刚刚升级为奶爸

赞同来自: 难易

好了,结贴,蛋疼的错误 忘记关闭防火墙。

jeffsui - 奔四的双鱼座,刚刚升级为奶爸

不知道什么原因,启动还是会失败 <pre> docker run -d -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v /opt/data/registry:/tmp/registry -p 5000:5000 registry cb59fe2304db57750d8f1517017f3535ef6a5caecfb27bb36bbe124f9e621090 Error response from daemon: Cannot start container cb59fe2304db57750d8f1517017f3535ef6a5caecfb27bb36bbe124f9e621090: iptables failed: iptables -t filter -A DOCKER ! -i docker0 -o docker0 -p tcp -d 172.17.0.5 --dport 5000 -j ACCEPT: iptables: No chain/target/match by that name. </pre> 查看`iptables -t nat -L` 显示结果如下: <pre> Chain PREROUTING (policy ACCEPT) target prot opt source destination DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination DOCKER all -- anywhere !loopback/8 ADDRTYPE match dst-type LOCAL Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 172.17.0.0/16 !172.17.0.0/16 MASQUERADE all -- 172.17.0.0/16 !172.17.0.0/16 Chain DOCKER (2 references) target prot opt source destination DNAT tcp -- anywhere anywhere tcp dpt:commplex-main to:172.17.0.4:5000 DNAT tcp -- anywhere anywhere tcp dpt:commplex-main to:172.17.0.5:5000 </pre>

要回复问题请先登录注册