从公共registry导入Docker镜像到OpenShift

我试图在OpenShift Online(下一代)上从这里部署一个Ubuntu镜像。 这是我遵循的步骤

$ oc new-project test $ oc new-app jedisct1/phusion-baseimage-latest I then deployed from the WebConsole 

但是,我得到一个失败的部署和错误状态的“图像退出”在pod页面上。 我可能做的任何特定的事情都是错误的?

以下是整个过程的日志。

 root@home:~# oc new-project test Now using project "test" on server "https://api.preview.openshift.com:443". You can add applications to this project with the 'new-app' command. For example, try: $ oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-hello-world.git to build a new hello-world application in Ruby. root@home:~# oc new-app jedisct1/phusion-baseimage-latest --> Found Docker image 7ff0885 (14 hours old) from Docker Hub for "jedisct1/phusion-baseimage-latest" * An image stream will be created as "phusion-baseimage-latest:latest" that will track this image * This image will be deployed in deployment config "phusion-baseimage-latest" * The image does not expose any ports - if you want to load balance or send traffic to this component you will need to create a service with 'expose dc/phusion-baseimage-latest --port=[port]' later * WARNING: Image "phusion-baseimage-latest" runs as the 'root' user which may not be permitted by your cluster administrator --> Creating resources with label app=phusion-baseimage-latest ... imagestream "phusion-baseimage-latest" created deploymentconfig "phusion-baseimage-latest" created --> Success Run 'oc status' to view your app. root@home:~# oc status In project test on server https://api.preview.openshift.com:443 dc/phusion-baseimage-latest deploys istag/phusion-baseimage-latest:latest deployment #1 pending on image or update 1 warning identified, use 'oc status -v' to see details. root@home:~# oc status -v In project test on server https://api.preview.openshift.com:443 dc/phusion-baseimage-latest deploys istag/phusion-baseimage-latest:latest deployment #1 pending on image or update Warnings: * dc/phusion-baseimage-latest has no readiness probe to verify pods are ready to accept traffic or ensure deployment is successful. try: oc set probe dc/phusion-baseimage-latest --readiness ... View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'. root@home:~# oc status -v In project test on server https://api.preview.openshift.com:443 dc/phusion-baseimage-latest deploys istag/phusion-baseimage-latest:latest deployment #2 running for 2 minutes - 1 pod 

我也试图在网上的Openshift同样的形象,我发现了一个“明显的未知错误”。

在这里输入图像说明

这是DockerHub的一个兼容性问题,正如克莱顿在这个答案中所说的那样。

API错误(500):清单未知:清单未知

 1. using Docker < 1.10 pull the image 2. tag it either as docker.io/<yourname>/imagename or ${INTERNAL_DOCKER_REGISTRY_IP}/openshift/imagename 3. push it using the same tag 4. deploy from that 

使用docker <1.10,你可以肯定的是推送的图像将是模式v1,可以通过当前registry版本和docker 1.9导入。

拉图像是没有问题的,因为Docker集线器将其转换为具有与集线器上摘要不同的摘要的架构v1。 所以如果你尝试使用这个摘要,你会失败,因为它不存储在集线器上。 因此,部署者将失败,因为docker工人不能提取摘要。

基本上,只要你使用docker <1.10,你就可以把它推到任何地方,这样你就可以确定得到的图像清单是模式v1的 – 这样的清单可以被任何版本的OpenShift和Docker安全地使用。

替代方法

你也可以把它推到OpenShift Online任何你想要的docker版本。 因为OpenShift的registry只存储v1模式。 然后,请参阅Docker Hub上推送的映像,而不是原始来源。