与本地dockerregistryopenshift起源

对于openshift来说是新的,我正在尝试一个基本的设置。 我在我的Windows笔记本电脑上的Ubuntu VM上安装了docker和openshift。 我没有任何问题在单独使用泊坞窗,推或从我的本地registry。 我在使用openshift原点中的oc new-app命令时遇到问题。

我有一个本地registry在我的虚拟机中运行

docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 26d3a527398d registry:2 "/bin/registry serve " 16 minutes ago Up 16 minutes 0.0.0.0:443->443/tcp, 0.0.0.0:5000->5000/tcp registry 

我已经推送了一个图像到这个registry

 docker images myregistry.com:5000/ubuntu REPOSITORY TAG IMAGE ID CREATED SIZE myregistry.com:5000/ubuntu latest cf62323fa025 7 days ago 125 MB 

当我尝试在openshift中使用这个图像时,我正在获取下面的错误

 ./oc new-app --docker-image=myregistry.com:5000/ubuntu error: can't look up Docker image "myregistry.com:5000/ubuntu": Internal error occurred: Get https://myregistry.com:5000/v2/: http: server gave HTTP response to HTTPS client error: no match for "myregistry.com:5000/ubuntu" The 'oc new-app' command will match arguments to the following types: 1. Images tagged into image streams in the current project or the 'openshift' project - if you don't specify a tag, we'll add ':latest' 2. Images in the Docker Hub, on remote registries, or on the local Docker engine 3. Templates in the current project or the 'openshift' project 4. Git repository URLs or local paths that point to Git repositories --allow-missing-images can be used to point to an image that does not exist yet. See 'oc new-app -h' for examples. 

这是我的DNS解决scheme吗? 我怎样才能在我的openshift起源中使用我的本地registry

openshift/origin/pkg/diagnostics/pod/auth.go#authenticateToRegistry()提到:

  case strings.Contains(secError.Error(), "tls: oversized record received"), strings.Contains(secError.Error(), "server gave HTTP response to HTTPS"): r.Debug("DP1015", "docker-registry not secured; falling back to cleartext connection") 

问题6516提到:

如果您的registry需要身份validation,那么这就是问题所在。 新应用程序无法从需要身份validation的registry中提取图像(这存在一个存在的问题),所以就其而言,该图像不存在于registry中。

问题6540 (OC 1.1.1)应该解决这个问题:

new-app可以使用一个似乎只存在于本地的图像(因为新的应用程序无法访问registry)。 它将继续定义预期的openshift对象( deploymentconfig等)并引用该映像。
如果节点也无法拉取图像,则部署最终仍会失败。 (不过与new-app不同, nodes能够从安全registry中提取图像)


OP Raghavan 在评论中报告了 如何在Ubuntu 14.04上设置一个家庭实验室的DNS服务器。

我在/etc/default/docker文件中添加了DNS和--insecure-registry选项

 DOCKER_OPTS=--dns 10.0.3.1 --insecure-registry ns1.myregistry.com:5000 

这里10.0.3.1是我的DNS服务器,也是ns1.myregistry.comregistry运行的服务器,主机名为ns1.myregistry.com