18. 18
OpenShift v3 Technical Introduction
OpenShiftにおけるイメージ管理
Docker Hub、もしくは、Dockerホストローカルのイメージは、「ユーザー名/リポジトリ名
: タグ」という名称で識別されます。
– タグによるバージョン管理が可能ですが、自由に付け替えができるため、利用者自身が意識的にタグ
名を操作する必要があります。
OpenShiftで取り扱うイメージは、専用の内部レジストリーに保存して、独自のバージョン
管理を行ないます。
– 内部レジストリーの中では、「プロジェクト名/リポジトリ名@<sha256ハッシュ>」という名称でイ
メージを識別します。ハッシュ値が、GitのコミットIDに相当するユニークな識別子になります。
– バージョン情報(イメージが更新された時系列)については、別途、「イメージストリーム」を定義
して、そちらで管理します。
# oc get is
NAME DOCKER REPO TAGS UPDATED
centos7 172.30.84.64:5000/project01/centos7 latest 7 days ago
etherpad-lite 172.30.84.64:5000/project01/etherpad-lite latest 7 days ago
nodejs-base 172.30.84.64:5000/project01/nodejs-base latest 7 days ago
# oc describe is etherpad-lite
Name: etherpad-lite
Created: 7 days ago
Labels: <none>
Annotations: openshift.io/image.dockerRepositoryCheck=2016-01-03T09:53:25Z
Docker Pull Spec: 172.30.84.64:5000/project01/etherpad-lite
Tag Spec Created PullSpec
latest <pushed> 5 days ago 172.30.84.64:5000/project01/etherpad-lite@sha256:9b5e7f9fc58...
7 days ago 172.30.84.64:5000/project01/etherpad-lite@sha256:05c4600b8ab...
project01のイメージストリーム一覧
イメージストリーム
「etherpad-lite」
に含まれるイメージ
19. 19
OpenShift v3 Technical Introduction
OpenShiftにおけるイメージ管理
イメージストリームには、次のような際に新しいバージョンのイメージが登録されます。
– 内部レジストリーにイメージをPushした時
• プッシュ時の「プロジェクト名/レジストリー名」から、対応するプロジェクトの(レジスト
リーと同名の)イメージストリームに新バージョンとして登録されます。
– OpenShiftのイメージビルドシステムを用いて、新しいイメージをビルドした時
• イメージビルドシステムは、GitHubで公開したDockerfile、アプリケーションのソースコードな
どを用いて、新しいイメージを作成、内部レジストリーに保存する機能です。
# docker pull centos:7
# docker login -u enakai -e enakai@example.com -p $(oc whoami -t) registry.oso.example.com
# docker tag docker.io/centos:7 registry.oso.example.com/project01/centos7:latest
# docker push registry.oso.example.com/project01/centos7:latest
# oc get is
NAME DOCKER REPO TAGS UPDATED
centos7 172.30.84.64:5000/project01/centos7 latest 7 seconds ago
# oc describe is centos7
ame: centos7
Created: 24 seconds ago
Labels: <none>
Annotations: openshift.io/image.dockerRepositoryCheck=2015-12-28T11:32:19Z
Docker Pull Spec: 172.30.84.64:5000/project01/centos7
Tag Spec Created PullSpec
latest <pushed> 24 seconds ago 172.30.84.64:5000/project01/centos7@sha256:b04ac...
CentOS7のイメージを
内部レジストリーに
Pushする例
24. 24
OpenShift v3 Technical Introduction
設定テンプレートによる環境構築
一連の設定ファイル(「イメージストリーム」「ビルド設定」「デプロイ設定」「サービ
ス」「ルーティング」)をテンプレート化することにより、典型的なアプリケーション環境
/開発環境が自動構築できるようになります。
# oc get -n openshift template
NAME DESCRIPTION PARAMETERS OBJECTS
cakephp-example An example CakePHP application with no database 14 (8 blank) 5
cakephp-mysql-example An example CakePHP application with a MySQL database 14 (3 blank) 7
dancer-example An example Dancer application with no database 7 (4 blank) 5
dancer-mysql-example An example Dancer application with a MySQL database 13 (4 blank) 7
django-example An example Django application with no database 12 (9 blank) 5
django-psql-example An example Django application with a PostgreSQL database 12 (4 blank) 7
jenkins-ephemeral Jenkins service, without persistent storage. WARNING: Any data stored will be... 2 (all set) 3
jenkins-persistent Jenkins service, with persistent storage. 3 (all set) 4
logging-deployer-template Template for deploying everything needed for aggregated logging. Requires clu... 19 (10 blank) 1
metrics-deployer-template Template for deploying the required Metrics integration. Requires cluster-adm... 9 (1 blank) 1
mongodb-ephemeral MongoDB database service, without persistent storage. WARNING: Any data store... 5 (3 generated) 2
mongodb-persistent MongoDB database service, with persistent storage. Scaling to more than one r... 6 (3 generated) 3
mysql-ephemeral MySQL database service, without persistent storage. WARNING: Any data stored... 4 (2 generated) 2
mysql-persistent MySQL database service, with persistent storage. Scaling to more than one rep... 5 (2 generated) 3
nodejs-example An example Node.js application with no database 11 (8 blank) 5
nodejs-mongodb-example An example Node.js application with a MongoDB database 11 (3 blank) 7
postgresql-ephemeral PostgreSQL database service, without persistent storage. WARNING: Any data st... 4 (2 generated) 2
postgresql-persistent PostgreSQL database service, with persistent storage. Scaling to more than on... 5 (2 generated) 3
rails-postgresql-example An example Rails application with a PostgreSQL database 15 (3 blank) 7
デフォルトで用意される
テンプレートの例