简体   繁体   中英

How to pull docker images from public registry and push it to private openshift?

I need to pull all images from an openshift template file, in my case it's openwhisk .
I'm trying to deploy this project on a private network so I don't have access to docker's official repository from there and thus need to push the images myself.
I was hoping there is a script/tool to automate this process.

There is no such available tool/script but you can write small shell script to do it.

If public dockerhub registry not allowed then either use private separate registry

or

Pull the image in your local laptop then tag it and push to openshift registry. After pushing all the image to openshift, import your openshift template to deploy your application.

Below is the steps for single image. you can define list of image and loop it over the list.

 docker pull imagename
 oc login https://127.0.0.1:8443 --token=<hidden_token> #copy from https://your_openshift_server:port/console/command-line
 oc project test
 oc create imagestream imagename
 docker login -u `oc whoami` -p `oc whoami --show-token` your_openshift_server:port
 docker tag imagename your_openshift_server:port/openshift_projectname/imagename:tag
 docker push your_openshift_server:port/openshift_projectname/imagename:tag

you can get more details on page suggested by graham-dumpleton .

Graham Dumpleton's book talks about this. You create a list (JSON) of all the images used and import that into the openshift namespace. Since your OpenShift is offline/disconnected, you'll also change any remote registry to the URL of the internal, hosted registry.

Example that imports all JBoss images: https://github.com/projectatomic/adb-utils/blob/master/services/openshift/templates/common/jboss-image-streams.json

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM