Openshift 从本地Docker映像打开新应用程序

Openshift 从本地Docker映像打开新应用程序,openshift,openshift-origin,Openshift,Openshift Origin,我正在尝试在Openshift源吊舱上部署一个可在Docker存储库中使用的映像: $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat9demo latest 535da1774da0


我正在尝试在Openshift源吊舱上部署一个可在Docker存储库中使用的映像:

$ docker images
REPOSITORY                                   TAG                 IMAGE ID            CREATED             SIZE
tomcat9demo                                  latest              535da1774da0        9 weeks ago         350.2 MB
--> 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 new-app tomcat9demo --name tomcatdemo
显然,它似乎从Docker存储库中找到了图像:

$ docker images
REPOSITORY                                   TAG                 IMAGE ID            CREATED             SIZE
tomcat9demo                                  latest              535da1774da0        9 weeks ago         350.2 MB
--> 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存储库中获取图像?

您需要指定选项--Docker image,使其指向您的本地图像repo。例如:


oc新应用程序tomcat9demo——docker映像tomcat9demo

您应该在本地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
docker build-t image\u name。
docker标签图像\名称:图像\名称:
oc新应用程序映像名称:---名称=应用程序名称
你应该看到:

Found Docker image <your docker image id> (19 minutes old) from  for "image_name:<new tag>"
从中找到“image\u name:”的Docker映像(19分钟前)

参考这段精彩的youtube视频,借助以下帮助,我成功地将本地docker映像部署到专用openshift平台的docker注册表中:


希望有帮助。

您如何运行OpenShift?使用
oc cluster up
minishift
或远程OpenShift环境?感谢我使用“oc cluster up--version=latest”运行OpenShift origin,我个人从未找到进行
docker构建的后门,而且它可以立即使用。从技术上讲,您仍然需要公开内部OpenShift注册表,并对其执行
docker推送操作。@GrahamDumpleton有没有关于如何操作的简便指南?卡拉,你让它工作了吗?看到了吗