我试图在Openshift Origin Pod上部署我的Docker存储库中可用的图像:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat9demo latest 535da1774da0 9 weeks ago 350.2 MB
运行时:
$ oc new-app tomcat9demo --name tomcatdemo
显然它似乎从Docker存储库中找到了图像:
--> Found Docker image 535da17 (9 weeks old) from for "tomcat9demo:latest"
* This image will be deployed in deployment config "tomcat9demo"
* Port 8080/tcp will be load balanced by service "tomcat9demo"
* Other containers can access this service through the hostname "tomcat9demo"
* WARNING: Image "tomcat9demo:latest" runs as the 'root' user which may not be permitted by your cluster administrator
--> Creating resources with label app=tomcat9demo ...
deploymentconfig "tomcat9demo" created
service "tomcat9demo" created
--> Success
但状态显示错误。图像拉动似乎有错误:
$ oc get pods
NAME READY STATUS RESTARTS AGE
tomcat9demo-1-zrj98 0/1 ErrImagePull 0 16s
$ oc status
Error from server: the server could not find the requested resource
我是否需要其他东西从本地Docker存储库中获取图像?
答案 0 :(得分:0)
您需要指定选项--docker-image,以使其指向本地映像存储库。示例:
oc new-app tomcat9demo --docker-image tomcat9demo
答案 1 :(得分:0)
您应该将标签添加到本地docker镜像。
docker build -t image_name .
docker tag image_name:<current tag ot just a latest> image_name:<new tag>
oc new-app mage_name:<new tag> --name=app_name
您应该看到:
Found Docker image <your docker image id> (19 minutes old) from for "image_name:<new tag>"
答案 2 :(得分:0)
参考这个很棒的youtube视频,借助以下帮助,我能够将本地docker映像成功部署到专用openshift平台的docker注册表中: Push local docker images to openshift registry - minishift
希望有帮助。