Importing Docker Images Images From The Public Registry Into OpenShift

落花浮王杯 提交于 2019-12-10 12:06:29

问题


I am trying to deploy an Ubuntu Image from the here on OpenShift Online (Next Generation). These are the steps I followed in doing so

$ oc new-project test
$ oc new-app jedisct1/phusion-baseimage-latest

I then deployed from the WebConsole

However I get a failed deploy and an error status of "image pulled back off" on the pod page. Any particular thing that I may be doing wrong?

Below are the logs of the entire proccess.

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

回答1:


I tried to pull the same image in Openshift online too, and I found out a "manifest unknow error".

This is a compatibility problem with DockerHub, as Clayton states in this answer.

API error (500): manifest unknown: manifest unknown




回答2:


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

Using docker < 1.10, you may be sure that the pushed image will be of schema v1 which is importable both by current registry version and docker 1.9.

Pulling images is no problem, because Docker hub converts it on the fly to schema v1 which has a different digest than the one on the hub. So if you try to pull using this digest you will fail because it isn't stored on the hub. Thus the deployer will fail because docker fails to pull given digest.

Basically, you can push it anywhere as long as you use docker < 1.10 so you can be sure that the resulting image manifest will be of schema v1 - such a manifest can be safely consumed by the OpenShift and docker of any version.

Alternative Approach

You can also push it to OpenShift Online with any docker version you want. Because OpenShift's registry stores only v1 schema. Then refer to the pushed image instead of original source on the Docker Hub.



来源:https://stackoverflow.com/questions/38457982/importing-docker-images-images-from-the-public-registry-into-openshift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!