[英]How to pull docker images from public registry and push it to private openshift?
[英]Importing Docker Images Images From The Public Registry Into OpenShift
我試圖從部署Ubuntu的圖片在這里對OpenShift在線(下一代)。 這些是我遵循的步驟
$ 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
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,可通過當前注冊表版本和docker 1.9導入。
提取映像沒有問題,因為Docker集線器會將其即時轉換為架構v1,該架構的摘要與集線器上的摘要不同。 因此,如果您嘗試使用此摘要進行提取,則將失敗,因為該摘要未存儲在集線器上。 因此,部署程序將失敗,因為docker無法提取給定的摘要。
基本上,只要使用docker <1.10,就可以將其推送到任何地方,這樣就可以確保生成的映像清單將是架構v1-這樣的清單可以被任何版本的OpenShift和docker安全地使用。
替代方法
您還可以使用所需的任何Docker版本將其推送到OpenShift Online。 因為OpenShift的注冊表僅存儲v1模式。 然后參考推送的映像,而不是Docker Hub上的原始源。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.