今天实践了创建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