今天实践了创建imagestream 不成功的case:
1: 先看一下image:
docker images 发现有个image 是nginx, 所以就build 一下,报错:
[root@test3 ~]# oc new-build --image-stream=nginx --binary=true --name=shp
warning: Cannot find git. Ensure that it is installed and in your path. Git is required to work with git repositories.
error: no match for "nginx"
后来发现这个imagestream 和image 有区别:
2: 先看一下imagestream:
[root@test3 ~]# oc get is
No resources found.
我就奇怪了,登入到网页上,发现这个is (imagestream 是根据不同的project 而显示不同的)
[root@test3 ~]# oc project shp
Now using project "shp" on server "https://localhost:8443".
[root@test3 ~]# oc get is
NAME DOCKER REPO TAGS UPDATED
hello-openshift latest 9 weeks ago
3:可以看到,切换到对应的project 下面,就可以看到imagestram 了。OK, 下面开始创建:
[root@test3 ~]# oc new-build --image-stream=hello-openshift --binary=true --name=sheng
warning: Cannot find git. Ensure that it is installed and in your path. Git is required to work with git repositories.
--> Found image 7af3297 (20 months old) in image stream "shp/hello-openshift" under tag "latest" for "hello-openshift"
* A Docker build using binary input will be created
* The resulting image will be pushed to image stream "sheng:latest"
* A binary build was created, use 'start-build --from-dir' to trigger a new build
--> Creating resources with label build=sheng ...
imagestream "sheng" created
buildconfig "sheng" created
--> Success
[root@test3 ~]# oc get is
NAME DOCKER REPO TAGS UPDATED
hello-openshift latest 9 weeks ago
sheng
[root@test3 ~]#
4: 下面看一下应用:
[root@test3 ~]# oc get dc
NAME REVISION DESIRED CURRENT TRIGGERED BY
hello-openshift 1 1 1 config,image(hello-openshift:latest)
发现还没有新的image 还么有开始被使用:
[root@test3 scripts]# oc start-build sheng --from-dir=/tool/scripts
Uploading directory "/tool/scripts" as binary input for the build ...
如果成功以后,就可以看到dc 拉:
[root@test3 ~]# oc get dc
本文详细介绍了在OpenShift环境中,ImageStream与普通Image之间的区别,并通过实践案例展示了如何正确创建ImageStream。文章指出,在指定的project下才能查看到相应的ImageStream,且在创建过程中需注意git是否已安装并存在于路径中。通过具体步骤,文章演示了从错误案例到成功创建ImageStream的全过程。
2340

被折叠的 条评论
为什么被折叠?



