MinishiftでRed Hatが提供しているコンテナイメージを使用する

OpenShiftではリリース元でもあるRed Hatが提供しているコンテナレジストリ上のイメージを使用できる構成になっているが、MinishiftではDockerHub上にあるイメージを使うようになっている。

ここでは、Minishift環境でもRed Hatのコンテナレジストリを使うためのImageStream作成をやってみる。

[Red Hat Container Catalog (RHCC) を使ってみよう！ | RED HAT OPENEYE -レッドハットの情報ポータル](https://jp-redhat.com/openeye_online/column/oss-note/5894/)

ただ、ライセンス/サブスクリプション関連の記述があいまいなので、使う場合はちゃんと確認したほうがよいかも。(Minishiftで本番運用はしないと思うけど)

> Docker が導入されている環境であれば追加の設定などは必要なく、すぐに利用可能ですので、ぜひ試してみてください。

とは書かれてるけど

> RHELイメージを利用する際のサブスクリプションですが、コンテナホストがRHELやAtomicの場合は、ホストのサブスクリプションを引き継いで動きます。
> RHEL以外のコンテナホスト上で稼働させた場合は、起動した各コンテナ内でサブスクリプションの割り当てを行う必要があります。（ほとんどのイメージは特に資格情報なくアクセスが可能ですが、一部にホストシステムのRHNへの登録が必要になる場合があります）

という記述もあって、RHELイメージじゃなくて、RHELベースで作ってあるAPサーバのイメージはどうなの？みたいな感じなので。。

---

2019.03.02 追記:
https://www.redhat.com/ja/blog/transitioning-red-hat-container-registry

2019年中に、現在の`registry.access.redhat.com`から、認証が必要なレジストリである`registry.redhat.io`へ移行予定とのこと。

# ImageStreamの作成

作業用のプロジェクトを作成する。

```
zaki@mascarpone% oc new-project rhccimage
Now using project "rhccimage" on server "https://192.168.99.100:8443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git

to build a new example application in Ruby.
zaki@mascarpone% 
```

初期状態

```
zaki@mascarpone% oc get is
No resources found.
```

```
zaki@mascarpone% oc get is -n openshift
NAME         DOCKER REPO                            TAGS                           UPDATED
dotnet       172.30.1.1:5000/openshift/dotnet       2.0,latest                     3 weeks ago
httpd        172.30.1.1:5000/openshift/httpd        2.4,latest                     3 weeks ago
jenkins      172.30.1.1:5000/openshift/jenkins      1,2,latest                     3 weeks ago
mariadb      172.30.1.1:5000/openshift/mariadb      latest,10.1,10.2               3 weeks ago
mongodb      172.30.1.1:5000/openshift/mongodb      3.2,3.4,3.6 + 3 more...        3 weeks ago
mysql        172.30.1.1:5000/openshift/mysql        latest,5.5,5.6 + 1 more...     3 weeks ago
nginx        172.30.1.1:5000/openshift/nginx        1.12,1.8,latest + 1 more...    3 weeks ago
nodejs       172.30.1.1:5000/openshift/nodejs       10,4,6 + 4 more...             3 weeks ago
perl         172.30.1.1:5000/openshift/perl         5.16,5.20,5.24 + 2 more...     3 weeks ago
php          172.30.1.1:5000/openshift/php          5.5,5.6,7.0 + 2 more...        3 weeks ago
postgresql   172.30.1.1:5000/openshift/postgresql   latest,10,9.2 + 3 more...      3 weeks ago
python       172.30.1.1:5000/openshift/python       2.7,3.3,3.4 + 3 more...        3 weeks ago
redis        172.30.1.1:5000/openshift/redis        3.2,latest                     3 weeks ago
ruby         172.30.1.1:5000/openshift/ruby         2.0,2.2,2.3 + 3 more...        3 weeks ago
tomcat       172.30.1.1:5000/openshift/tomcat       8.5                            3 weeks ago
wildfly      172.30.1.1:5000/openshift/wildfly      latest,10.0,10.1 + 5 more...   3 weeks ago
```

ImageStreamを作成するには`oc import-image`か`oc tag`を使用する。

## import-imageを使ったImageStream作成

[JBoss Web Server 3.1 - Tomcat 8](https://access.redhat.com/containers/#/registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift)のImageStreamを作ってみる

```
zaki@mascarpone% oc import-image --from=registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift:1.3 openshift/jboss-webserver31-tomcat8-openshift:1.3 --confirm
imagestream.image.openshift.io/jboss-webserver31-tomcat8-openshift imported

Name:                   jboss-webserver31-tomcat8-openshift
Namespace:              rhccimage
Created:                27 seconds ago
Labels:                 <none>
Annotations:            openshift.io/image.dockerRepositoryCheck=2019-02-04T00:44:46Z
Docker Pull Spec:       172.30.1.1:5000/rhccimage/jboss-webserver31-tomcat8-openshift
Image Lookup:           local=false
Unique Images:          1
Tags:                   1

1.3
  tagged from registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift:1.3

  * registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift@sha256:ab5959c16a06df4550732052d9866a1ee75366d6c59420dc52f1b2372e9034bb
      2 seconds ago

Image Name:     jboss-webserver31-tomcat8-openshift:1.3
Docker Image:   registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift@sha256:ab5959c16a06df4550732052d9866a1ee75366d6c59420dc52f1b2372e9034bb
Name:           sha256:ab5959c16a06df4550732052d9866a1ee75366d6c59420dc52f1b2372e9034bb
Created:        2 seconds ago
Annotations:    image.openshift.io/dockerLayersOrder=ascending
Image Size:     207.7MB in 6 layers
Layers:         74.92MB sha256:378837c0e24ad4a2e33f0eb3d68dc0c31d9a7dbbd5357d4acafec1d3a7930602
                1.303kB sha256:e17262bc23414bd3c0e9808ad7a87b055fe5afec386da42115a839ea2083d233
                3.805MB sha256:2b388249dd00874a09aa72ed41b2f47e0c9b7b93a0d21bb98ed329e7fdfe3ec4
                70.37MB sha256:2151c1f021ed0974a5f18fe537515f6a59edce967c779eeb5be10651c62a6bdc
                12.22MB sha256:15cb14de34215893c070e83cfc5d19a15db5748b9b072c72e0486f0531b22d19
                46.34MB sha256:923db5af1b66d1ea301cd8807b3f4be346f286dcbd870fc91891e8322bd748e7
Image Created:  3 months ago
Author:         <none>
Arch:           amd64
Command:        /opt/webserver/bin/launch.sh
Working Dir:    /home/jboss
User:           185
Exposes Ports:  8080/tcp, 8443/tcp, 8778/tcp
Docker Labels:  architecture=x86_64
                authoritative-source-url=registry.access.redhat.com
                build-date=2018-10-18T11:34:44.456526
                com.redhat.build-host=cpt-0004.osbs.prod.upshift.rdu2.redhat.com
                com.redhat.component=jboss-webserver-3-webserver31-tomcat8-openshift-container
                com.redhat.deployments-dir=/opt/webserver/webapps
                com.redhat.dev-mode=DEBUG:true
                com.redhat.dev-mode.port=JPDA_ADDRESS:8000
                description=Red Hat JBoss Web Server 3.1 - Tomcat 8 OpenShift container image
                distribution-scope=public
                io.cekit.version=2.1.4
                io.fabric8.s2i.version.jolokia=1.5.0-redhat-1
                io.fabric8.s2i.version.maven=3.5
                io.k8s.description=Platform for building and running web applications on JBoss Web Server 3.1 - Tomcat v8
                io.k8s.display-name=JBoss Web Server 3.1
                io.openshift.expose-services=8080:http
                io.openshift.s2i.destination=/tmp
                io.openshift.s2i.scripts-url=image:///usr/local/s2i
                io.openshift.tags=builder,java,tomcat8
                maintainer=Cloud Enablement Feedback <cloud-enablement-feedback@redhat.com>
                name=jboss-webserver-3/webserver31-tomcat8-openshift
                org.concrt.version=2.1.4
                org.jboss.container.deployments-dir=/deployments
                org.jboss.deployments-dir=/opt/webserver/webapps
                org.jboss.product=webserver-tomcat8
                org.jboss.product.openjdk.version=1.8.0
                org.jboss.product.version=3.1.5
                org.jboss.product.webserver-tomcat8.version=3.1.5
                release=9
                summary=Red Hat JBoss Web Server 3.1 - Tomcat 8 OpenShift container image
                url=https://access.redhat.com/containers/#/registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift/images/1.3-9
                usage=This image is very generic and does not serve a single use case. Use it as a base to build your own images.
                vcs-ref=376df109ec1e7ec15751314bb5eb4a6940fd1090
                vcs-type=git
                vendor=Red Hat, Inc.
                version=1.3
Environment:    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                container=oci
                HOME=/home/jboss
                JBOSS_IMAGE_NAME=jboss-webserver-3/webserver31-tomcat8-openshift
                JBOSS_IMAGE_VERSION=1.3
                JAVA_HOME=/usr/lib/jvm/java-1.8.0
                JAVA_VENDOR=openjdk
                JAVA_VERSION=1.8.0
                CATALINA_OPTS=-Djava.security.egd=file:/dev/./urandom
                JBOSS_PRODUCT=webserver
                JBOSS_WEBSERVER_VERSION=3.1.5
                JPDA_ADDRESS=8000
                JWS_HOME=/opt/webserver
                PRODUCT_VERSION=3.1.5
                TOMCAT_VERSION=8.0.36
                AB_JOLOKIA_AUTH_OPENSHIFT=true
                AB_JOLOKIA_HTTPS=true
                AB_JOLOKIA_PASSWORD_RANDOM=true
                JBOSS_CONTAINER_JAVA_JVM_MODULE=/opt/jboss/container/java/jvm
                JBOSS_CONTAINER_JAVA_PROXY_MODULE=/opt/jboss/container/java/proxy
                JBOSS_CONTAINER_JOLOKIA_MODULE=/opt/jboss/container/jolokia
                JBOSS_CONTAINER_JWS_S2I_MODULE=/opt/jboss/container/jws/s2i
                JBOSS_CONTAINER_MAVEN_35_MODULE=/opt/jboss/container/maven/35/
                JBOSS_CONTAINER_MAVEN_DEFAULT_MODULE=/opt/jboss/container/maven/default/
                JBOSS_CONTAINER_MAVEN_S2I_MODULE=/opt/jboss/container/maven/s2i
                JBOSS_CONTAINER_S2I_CORE_MODULE=/opt/jboss/container/s2i/core/
                JBOSS_CONTAINER_UTIL_LOGGING_MODULE=/opt/jboss/container/util/logging/
                JOLOKIA_VERSION=1.5.0
                MAVEN_VERSION=3.5
                S2I_SOURCE_DEPLOYMENTS_FILTER=*.war
                STI_BUILDER=jee


zaki@mascarpone% 
```

```
zaki@mascarpone% oc get is
NAME                                  DOCKER REPO                                                     TAGS      UPDATED
jboss-webserver31-tomcat8-openshift   172.30.1.1:5000/rhccimage/jboss-webserver31-tomcat8-openshift   1.3       29 seconds ago
```

`openshift`とネームスペース指定のつもりだけど、なぜか`import-image`だと現在のネームスペースにImageStreamが作られてしまう。そういう仕様なのかbugなのか…

`openshift`ネームスペースに作成するのであれば、

1. cluster-admin権限のユーザになる

```
zaki@mascarpone% oc login -u system:admin
Logged into "https://192.168.99.100:8443" as "system:admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project <projectname>':

    default
    kube-dns
    kube-proxy
    kube-public
    kube-system
    myproject
    openshift
    openshift-apiserver
    openshift-controller-manager
    openshift-core-operators
    openshift-infra
    openshift-node
    openshift-service-cert-signer
    openshift-web-console
  * rhccimage
    samplepj
    testapp
    testpj

Using project "rhccimage".
zaki@mascarpone% 
```

2. `openshift`ネームスペースを選択

```
zaki@mascarpone% oc project openshift
Now using project "openshift" on server "https://192.168.99.100:8443".
```

※ (この選択操作はデフォルトの`developer`ユーザだと権限がない)

3. `import-image`を実行

```
zaki@mascarpone% oc import-image --from=registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift:1.3 openshift/jboss-webserver31-tomcat8-openshift:1.3 --confirm
imagestream.image.openshift.io/jboss-webserver31-tomcat8-openshift imported

Name:                   jboss-webserver31-tomcat8-openshift
Namespace:              openshift
Created:                1 second ago
Labels:                 <none>
Annotations:            openshift.io/image.dockerRepositoryCheck=2019-02-04T00:48:42Z
Docker Pull Spec:       172.30.1.1:5000/openshift/jboss-webserver31-tomcat8-openshift
Image Lookup:           local=false
Unique Images:          1
Tags:                   1

1.3
  tagged from registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift:1.3


  * registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift@sha256:ab5959c16a06df4550732052d9866a1ee75366d6c59420dc52f1b2372e9034bb
      1 second ago

Image Name:     jboss-webserver31-tomcat8-openshift:1.3
:
[snip]
```

```
zaki@mascarpone% oc get is
NAME                                  DOCKER REPO                                                     TAGS                           UPDATED
dotnet                                172.30.1.1:5000/openshift/dotnet                                latest,2.0                     3 weeks ago
httpd                                 172.30.1.1:5000/openshift/httpd                                 2.4,latest                     3 weeks ago
jboss-webserver31-tomcat8-openshift   172.30.1.1:5000/openshift/jboss-webserver31-tomcat8-openshift   1.3                            2 seconds ago
jenkins                               172.30.1.1:5000/openshift/jenkins                               latest,1,2                     3 weeks ago
mariadb                               172.30.1.1:5000/openshift/mariadb                               10.1,10.2,latest               3 weeks ago
mongodb                               172.30.1.1:5000/openshift/mongodb                               2.4,2.6,3.2 + 3 more...        3 weeks ago
mysql                                 172.30.1.1:5000/openshift/mysql                                 5.5,5.6,5.7 + 1 more...        3 weeks ago
nginx                                 172.30.1.1:5000/openshift/nginx                                 1.10,1.12,1.8 + 1 more...      3 weeks ago
nodejs                                172.30.1.1:5000/openshift/nodejs                                6,8,8-RHOAR + 4 more...        3 weeks ago
perl                                  172.30.1.1:5000/openshift/perl                                  5.26,latest,5.16 + 2 more...   3 weeks ago
php                                   172.30.1.1:5000/openshift/php                                   5.6,7.0,7.1 + 2 more...        3 weeks ago
postgresql                            172.30.1.1:5000/openshift/postgresql                            10,9.2,9.4 + 3 more...         3 weeks ago
python                                172.30.1.1:5000/openshift/python                                2.7,3.3,3.4 + 3 more...        3 weeks ago
redis                                 172.30.1.1:5000/openshift/redis                                 3.2,latest                     3 weeks ago
ruby                                  172.30.1.1:5000/openshift/ruby                                  2.0,2.2,2.3 + 3 more...        3 weeks ago
tomcat                                172.30.1.1:5000/openshift/tomcat                                8.5                            3 weeks ago
wildfly                               172.30.1.1:5000/openshift/wildfly                               13.0,8.1,9.0 + 5 more...       3 weeks ago
```

これで作成される。

---

ちなみに既存のものと同じImageStream名で別タグを追加する場合は

```
zaki@mascarpone% oc import-image --from=registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift:1.2 openshift/jboss-webserver31-tomcat8-openshift:1.2 --confirm
imagestream.image.openshift.io/jboss-webserver31-tomcat8-openshift imported

Name:                   jboss-webserver31-tomcat8-openshift
Namespace:              openshift
Created:                5 minutes ago
Labels:                 <none>
Annotations:            openshift.io/image.dockerRepositoryCheck=2019-02-04T00:53:54Z
Docker Pull Spec:       172.30.1.1:5000/openshift/jboss-webserver31-tomcat8-openshift
Image Lookup:           local=false
Unique Images:          2
Tags:                   2

1.3
  tagged from registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift:1.3

  * registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift@sha256:ab5959c16a06df4550732052d9866a1ee75366d6c59420dc52f1b2372e9034bb
      5 minutes ago

1.2
  tagged from registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift:1.2

  * registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift@sha256:4485c46c9a044f819827e9049b33ee8cec28329c00b2a9e022c451f2f01d14ad
      1 second ago

Image Name:     jboss-webserver31-tomcat8-openshift:1.2
```

普通に追加実行してあげればOK

```
zaki@mascarpone% oc get is jboss-webserver31-tomcat8-openshift
NAME                                  DOCKER REPO                                                     TAGS                         UPDATED
jboss-webserver31-tomcat8-openshift   172.30.1.1:5000/openshift/jboss-webserver31-tomcat8-openshift   1.2,1.3                      13 seconds ago
```

(以前はこれできなかった気がするけど気のせいかな)

## tagを使ったImageStream作成

`import-image`でなく、`tag`でもImageStreamを作成できる。
また、`import-image`と違って、ネームスペースを指定することもできる。
今度は[MySQL 5.7](https://access.redhat.com/containers/#/registry.access.redhat.com/rhscl/mysql-57-rhel7)を作ってみる。

(標準で使えるMySQLのImageStreamのオブジェクト名も`mysql`なので、区別するために名前を`rhcc-mysql`としている)

```
zaki@mascarpone% oc project
Using project "rhccimage" on server "https://192.168.99.100:8443".
zaki@mascarpone% oc tag --source=docker registry.access.redhat.com/rhscl/mysql-57-rhel7:5.7 openshift/rhcc-mysql:5.7
Error from server (Forbidden): imagestreams.image.openshift.io "rhcc-mysql" is forbidden: User "developer" cannot update imagestreams.image.openshift.io in the namespace "openshift": no RBAC policy matched
```

そういえば`developer`ユーザだと`openshift`ネームスペースへの権限がなかった。

```
]zaki@mascarpone% oc login -u system:admin
Logged into "https://192.168.99.100:8443" as "system:admin" using existing credentials.
:
:
Using project "rhccimage".
```

```
zaki@mascarpone% oc tag --source=docker registry.access.redhat.com/rhscl/mysql-57-rhel7:5.7 openshift/rhcc-mysql:5.7
Tag openshift/rhcc-mysql:5.7 set to registry.access.redhat.com/rhscl/mysql-57-rhel7:5.7.
zaki@mascarpone% oc get is -n openshift rhcc-mysql
NAME         DOCKER REPO                            TAGS      UPDATED
rhcc-mysql   172.30.1.1:5000/openshift/rhcc-mysql   5.7       5 seconds ago
```

# デプロイ

## MySQL

新しく作ったImageStream用のテンプレートがないのでImageStreamを直接指定して起動する。

```
zaki@mascarpone% oc new-app openshift/rhcc-mysql:5.7 -e MYSQL_USER=memoapp -e MYSQL_PASSWORD=memoapp -e MYSQL_DATABASE=memoapp_db --name memoapp-db                   [~]
--> Found image c07bf25 (10 days old) in image stream "openshift/rhcc-mysql" under tag "5.7" for "openshift/rhcc-mysql:5.7"

    MySQL 5.7 
    --------- 
    MySQL is a multi-user, multi-threaded SQL database server. The container image provides a containerized packaging of the MySQL mysqld daemon and client application. The mysqld server daemon accepts connections from clients and provides access to content from MySQL databases on behalf of the clients.

    Tags: database, mysql, mysql57, rh-mysql57

    * This image will be deployed in deployment config "memoapp-db"
    * Port 3306/tcp will be load balanced by service "memoapp-db"
      * Other containers can access this service through the hostname "memoapp-db"

--> Creating resources ...
    imagestreamtag.image.openshift.io "memoapp-db:5.7" created
    deploymentconfig.apps.openshift.io "memoapp-db" created
    service "memoapp-db" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose svc/memoapp-db' 
    Run 'oc status' to view your app.
zaki@mascarpone% 
```

※ ImageStream作成時に、同じ`mysql`オブジェクトでタグを`rhcc.5.7`とかにすれば同じテンプレートを使えたな。。

```
zaki@mascarpone% oc get pod                                                                                                                                           [~]
NAME                 READY     STATUS    RESTARTS   AGE
memoapp-db-1-qbmqn   1/1       Running   0          23s
```

Podに入ってエンコードを確認…したけど、やっぱり`latin1`でした。

```
sh-4.2$ mysql -u memoapp -p -D memoapp_db
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like '%char%';
+--------------------------+--------------------------------------------------------------+
| Variable_name            | Value                                                        |
+--------------------------+--------------------------------------------------------------+
| character_set_client     | latin1                                                       |
| character_set_connection | latin1                                                       |
| character_set_database   | latin1                                                       |
| character_set_filesystem | binary                                                       |
| character_set_results    | latin1                                                       |
| character_set_server     | latin1                                                       |
| character_set_system     | utf8                                                         |
| character_sets_dir       | /opt/rh/rh-mysql57/root/usr/share/rh-mysql57-mysql/charsets/ |
+--------------------------+--------------------------------------------------------------+
8 rows in set (0.02 sec)

mysql>
```

## webapp

ベースイメージにRHCCのイメージで作ったImageStreamを指定して`new-app`を実行。
これはWildFlyでなくTomcatと同じ設定で動くので、JNDIデータソースの設定は[webapp/META-INF/*-ds.xml](https://github.com/zaki-lknr/javaee-memoapp2/blob/master/src/main/webapp/META-INF/memoapp2-ds.xml)でなく、[webapp/META-INF/context.xml](https://github.com/zaki-lknr/javaee-memoapp2/blob/master/src/main/webapp/META-INF/context.xml)が参照される。

```xml:context.xml
 <Resource
  name="jdbc/memoapp_db"
  auth="Container"
  type="javax.sql.DataSource"
  maxTotal="100"
  maxIdle="30"
  maxWaitMillis="10000"
  username="memoapp"
  password="memoapp"
  driverClassName="com.mysql.jdbc.Driver"
  url="jdbc:mysql://memoapp-db:3306/memoapp_db?useUnicode=yes&amp;characterEncoding=utf8" />

</Context>
```

こんな感じ

```
zaki@mascarpone% oc new-app openshift/jboss-webserver31-tomcat8-openshift:1.3~'http://registry.example.org/gitbucket/git/zaki/javaee-memoapp2.git#minishift-rhcc'
--> Found image 8af6838 (3 months old) in image stream "openshift/jboss-webserver31-tomcat8-openshift" under tag "1.3" for "openshift/jboss-webserver31-tomcat8-openshift:1.3"

    JBoss Web Server 3.1 
    -------------------- 
    Platform for building and running web applications on JBoss Web Server 3.1 - Tomcat v8

    Tags: builder, java, tomcat8

    * A source build using source code from http://naru.jp-z.jp:8080/gitbucket/git/zaki/javaee-memoapp2.git#minishift-rhcc will be created
      * The resulting image will be pushed to image stream tag "javaee-memoapp2:latest"
      * Use 'start-build' to trigger a new build
    * This image will be deployed in deployment config "javaee-memoapp2"
    * Ports 8080/tcp, 8443/tcp, 8778/tcp will be load balanced by service "javaee-memoapp2"
      * Other containers can access this service through the hostname "javaee-memoapp2"

--> Creating resources ...
    imagestream.image.openshift.io "javaee-memoapp2" created
    buildconfig.build.openshift.io "javaee-memoapp2" created
    deploymentconfig.apps.openshift.io "javaee-memoapp2" created
    service "javaee-memoapp2" created
--> Success
    Build scheduled, use 'oc logs -f bc/javaee-memoapp2' to track its progress.
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose svc/javaee-memoapp2' 
    Run 'oc status' to view your app.
zaki@mascarpone% 
```

```
zaki@mascarpone% oc get pod                                                                                                                                           [~]
NAME                      READY     STATUS      RESTARTS   AGE
javaee-memoapp2-1-build   0/1       Completed   0          9m
javaee-memoapp2-1-hqbvq   1/1       Running     0          11s
memoapp-db-1-lntd5        1/1       Running     0          36m
```

```
zaki@mascarpone% oc logs javaee-memoapp2-1-hqbvq  
2019-02-04 02:33:15,146 [localhost-startStop-1] INFO  org.apache.catalina.startup.HostConfig- Deploying web application archive /deployments/memoapp2.war
2019-02-04 02:33:20,915 [localhost-startStop-1] INFO  org.apache.jasper.servlet.TldScanner- At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2019-02-04 02:33:21,147 [localhost-startStop-1] INFO  org.apache.catalina.startup.HostConfig- Deployment of web application archive /deployments/memoapp2.war has finished in 6,001 ms
2019-02-04 02:33:21,152 [localhost-startStop-1] INFO  org.apache.catalina.startup.HostConfig- Deploying web application directory /deployments/manager
2019-02-04 02:33:22,317 [localhost-startStop-1] INFO  org.apache.jasper.servlet.TldScanner- At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2019-02-04 02:33:22,343 [localhost-startStop-1] INFO  org.apache.catalina.startup.HostConfig- Deployment of web application directory /deployments/manager has finished in 1,191 ms
2019-02-04 02:33:22,382 [main] INFO  org.apache.coyote.http11.Http11AprProtocol- Starting ProtocolHandler ["http-apr-8080"]
2019-02-04 02:33:22,459 [main] INFO  org.apache.catalina.startup.Catalina- Server startup in 7481 ms
```

![image.png](https://qiita-image-store.s3.amazonaws.com/0/256859/9d7e59e3-db5b-f6fd-f242-2d96fbe065d0.png)


![image.png](https://qiita-image-store.s3.amazonaws.com/0/256859/4a5511bf-8bc5-7860-56eb-dde23d01243a.png)

動く、、動くぞ・・・