$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CloudGarageRancherMeetupTokyo#10
Search
MiyataAKiyoshi
October 11, 2017
Technology
0
690
CloudGarageRancherMeetupTokyo#10
Deploying Docker Container Images to CloudGarage
MiyataAKiyoshi
October 11, 2017
Tweet
Share
More Decks by MiyataAKiyoshi
See All by MiyataAKiyoshi
2018.10#ssmjp-CloudGarageDevAssistProgram
miyataakiyoshi
0
41
CloudGarageRenewal2018.02
miyataakiyoshi
0
370
CloudGarageConcrete5TokyoMeetup#12
miyataakiyoshi
0
88
CloudGarageRancherMeetupFukuoka#2
miyataakiyoshi
0
500
CloudGarageRancherMeetupTokyo#9
miyataakiyoshi
0
380
CloudGarageServiceOutline
miyataakiyoshi
0
1.3k
Other Decks in Technology
See All in Technology
5分で知るMicrosoft Ignite
taiponrock
PRO
0
400
チーリンについて
hirotomotaguchi
6
2.1k
まだ間に合う! Agentic AI on AWSの現在地をやさしく一挙おさらい
minorun365
13
1.3k
regrowth_tokyo_2025_securityagent
hiashisan
0
260
.NET 10の概要
tomokusaba
0
120
ハッカソンから社内プロダクトへ AIエージェント「ko☆shi」開発で学んだ4つの重要要素
sonoda_mj
5
680
品質のための共通認識
kakehashi
PRO
4
380
AWS re:Invent 2025で見たGrafana最新機能の紹介
hamadakoji
0
430
S3を正しく理解するための内部構造の読解
nrinetcom
PRO
3
190
Databricks向けJupyter Kernelでデータサイエンティストの開発環境をAI-Readyにする / Data+AI World Tour Tokyo After Party
genda
1
580
100以上の新規コネクタ提供を可能にしたアーキテクチャ
ooyukioo
0
120
MySQLとPostgreSQLのコレーション / Collation of MySQL and PostgreSQL
tmtms
1
1k
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
70
Evolving SEO for Evolving Search Engines
ryanjones
0
71
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
How to make the Groovebox
asonas
2
1.8k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
63
35k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
115
91k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
46
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
75
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Transcript
Copyright © NHN Techorus Corp. NHNテコラス株式会社 クラウドサービス開発室 宮田 晃佳 Dockerコンテナイメージの
クラウド環境へのデプロイ Service Site Facebook Twitter https://cloudgarage.jp @CloudGarage.PR @CloudGarage_PR
Page 2 Instance-01 Instance-02 Instance-03 Replication 前提 DB (Rancher-Server) DB
(Rancher-Server) DB (Rancher-Server) Docker-container RANCHER-Server Docker-container RANCHER-Server Docker-container RANCHER-Server 複数のサーバーインスタンスの環境に、牧場を持っている牧場主
Page 3 Instance-01 Instance-02 Instance-03 Replication 最終ゴール DB (Rancher-Server) DB
(Rancher-Server) DB (Rancher-Server) Docker-container RANCHER-Server Docker-container RANCHER-Server Docker-container RANCHER-Server 第3牧場で「たぬき」を飼う 実行環境
Page 4 サーバーインスタンス Service Site Facebook Twitter https://cloudgarage.jp @CloudGarage.PR @CloudGarage_PR
Page 5 hashtag #CloudGarage 事前準備(1) GitLab用のドメインを取得 GitLab用ドメインで2種類のAレコードを設定・取得 CloudGarageの接続許可ポート設定 http 80
ssh 3000 Terminalログインが22ポートを 利用中のため、3000ポートで代用 ・GitLab Server ・GitLab Container Registry Instahce01 Instance02 Instance03
Page 6 事前準備(2) 牧場3のインスタンスでGitLab Container Registry用の設定を追加 Docker Registryは通常https通信で利用 http通信を行うためには、各インスタンスのDockerのサービス設定を変更 Ubuntuの変更方法は以下
(A)インスタンスにログイン ssh root@(各インスタンスのグローバルIPアドレス) (B)docker サービスを編集 (C)Docker サービスを再起動 # vi /etc/systemd/system/multi-user.target.wants/docker.service ExecStart=/usr/bin/dockerd -H fd:// ↓ ↓ ↓ ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry [ドメイン名] # systemctl daemon-reload # systemctl restart docker Instahce01 Instance02 Instance03
Page 7 hashtag #CloudGarage GitLabの起動
Page 8 hashtag #CloudGarage GitLab インストール(1) Rancherにログインし、GitLabインストール Rancherにログインし、[インフラストラクチャ]->[ホスト]の順にクリック サーバーインスタンス(今回は牧場03)の[編集]ボタンをクリック ラベルを追加して[保存]をクリック
キー:server_group 値 :gitlab Instahce01 Instance02 Instance03
Page 9 hashtag #CloudGarage GitLab インストール(2) メニューバーより[スタック]->[スタックを追加]ボタンをクリック 名前を入力し、[作成]ボタンをクリック 名前:Gitlab Instahce01
Instance02 Instance03
Page 10 hashtag #CloudGarage GitLab インストール(3) 作成したGitlabをクリックして、[サービス追加]ボタンをクリック Instahce01 Instance02 Instance03
Page 11 hashtag #CloudGarage GitLab インストール(4) [サービスを追加]の設定 名前 :Server イメージ名を選択:gitlab/gitlab-ce:latest
ポートマップ : パブリックホストポート プライベートコンテナポート 80 80 3000 22 Instahce01 Instance02 Instance03
Page 12 hashtag #CloudGarage GitLab インストール(5) [サービスを追加][コマンド]タブの設定 GITLAB_OMNIBUS_CONFIG external_url 'http://gitlab.xxxxxxxxxx.jp'
registry_external_url 'http://register. xxxxxxxxxx.jp' gitlab_rails['gitlab_shell_ssh_port'] = 3000 Instahce01 Instance02 Instance03
Page 13 hashtag #CloudGarage GitLab インストール(6) [サービスを追加][ボリューム]タブの設定 /srv/gitlab/config:/etc/gitlab /srv/gitlab/logs:/var/log/gitlab /srv/gitlab/data:/var/opt/gitlab
[サービスを追加][スケジューリング]タブの設定 条件 :must フィールド:ホストラベル キー :server_group 値 :gitlab Instahce01 Instance02 Instance03
Page 14 hashtag #CloudGarage GitLab インストール(7) GitLabの起動を確認 http://gitlab.xxxxxxxxxx.jp/ Instahce01 Instance02
Instance03
Page 15 hashtag #CloudGarage GitLab:Container Registry
Page 16 hashtag #CloudGarage GitLabの設定(1) 初期パスワードを登録しログイン後、プロジェクトの作成 [+]ボタンをクリック [New Project]を選択 Instahce01
Instance02 Instance03
Page 17 hashtag #CloudGarage GitLabの設定(2) プロジェクトの作成 Project name:test Instahce01 Instance02
Instance03
Page 18 hashtag #CloudGarage GitLabの設定(3) プロジェクト作成完了 [Registry]をクリックし作成できていることを確認 右ペインに表示される内容でDockerイメージをpushできます docker login時にアカウントとパスワードが必要なので忘れずに
Instahce01 Instance02 Instance03
Page 19 hashtag #CloudGarage Rancherの設定(1) Rancherのレジストリに追加 [インフラストラクチャ]->[レジストリ]を選択し[レジストリを追加]ボタンをクリック Instahce01 Instance02 Instance03
Page 20 hashtag #CloudGarage Rancherの設定(2) CUSTOMレジストリを追加 アドレス :GitLab Containter Registry用のURL
ユーザー :GitLabのアカウント パスワード:GitLabのパスワード Instahce01 Instance02 Instance03
Page 21 hashtag #CloudGarage 利用例)WordPress
Page 22 hashtag #CloudGarage 操作コマンドの確認 GitLab Container Registry [コピー]ボタンをクリックすると、RegistryのURLをコピー register.xxxxxxxxxx.jp/root/test
右ペインのコマンドで、 Build/pushなどができます Instahce01 Instance02 Instance03
Page 23 hashtag #CloudGarage Instahce01 Instance02 Instance03 牧場1にアクセスし、WordPressのコンテナイメージ取得 $ docker
image pull wordpress $ docker image pull mysql:5.7 WordPressのコンテナイメージをGitLabにpullする $ docker login register.xxxxxxxxxxxxxxxxxxx.jp Username: [設定したユーザ名] Password: [設定したパスワード] Login Succeeded $ docker image tag wordpress register.xxxxxxxxxxxxxxxxxxx.jp/root/wordpress $ docker image tag mysql:5.7 register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql $ docker push register.xxxxxxxxxxxxxxxxxxx.jp/root/wordpress $ docker push register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql WordPress:コンテナイメージの配置 これまでの説明と同様に、WordPress用のRegistryを登録 Instahce01 Instance02 Instance03 「WordPress」と「MySQL」の2つを準備(後で利用します!) register.xxxxxxxxxxxxxxxxxxx.jp/root/wordpress register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql
Page 24 hashtag #CloudGarage WordPress:Rancherでの管理準備 Rancherにログインし、実行環境にラベル追加 Rancherにログインし、[インフラストラクチャ]->[ホスト]の順にクリック サーバーインスタンス(牧場1)の編集ボタンをクリック ラベルを追加して[保存]をクリック(今回は牧場2も忘れずに) キー:server_group
値 :wordpress Instahce01 Instance02 Instance03
Page 25 hashtag #CloudGarage WordPress:Rancherでの管理準備 メニューバーより[スタック]->[スタックを追加]ボタンをクリック 名前を入力し、[作成]ボタンをクリック 名前:WordPress Instahce01 Instance02
Instance03
Page 26 hashtag #CloudGarage WordPress:Rancherにコンテナイメージ登録 作成したWordPressをクリックして、[サービス追加]ボタンをクリック Instahce01 Instance02 Instance03 [サービスを追加]の設定
- MySQL 名前 :MySQL1 イメージ名を選択:GitLabにPullしたイメージ register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql
Page 27 hashtag #CloudGarage [コマンド]タブの設定 - MySQL WordPress:Rancherにコンテナイメージ登録 条件 :must
フィールド:ホストラベル キー :server_group 値 :wordpress Instahce01 Instance02 Instance03 [スケジューリング]タブの設定 - MySQL 変数:MYSQL_ROOT_PASSWORD 値 :mysql
Page 28 hashtag #CloudGarage WordPress:Rancherにコンテナイメージ登録 [サービスを追加]の設定 - WordPress 名前 :WordPress1
イメージ名を選択:GitLabにPullしたイメージ register.xxxxx.jp/root/wordpress ポートマップ :80 > 80 サービスリンク :MySQL1 > mysql Instahce01 Instance02 Instance03
Page 29 hashtag #CloudGarage WordPress:Rancherにコンテナイメージ登録 変数:WORDPRESS_DB_PASSWORD 値 :mysql [コマンド]タブの設定 -
WordPress [スケジューリング]タブの設定 - WordPress 条件 :must フィールド:ホストラベル キー :server_group 値 :wordpress
Page 30 hashtag #CloudGarage WordPress:コンテナクローン MySQL1のクローン作成 名前:MySQL2 Instahce01 Instance02 Instance03
Page 31 hashtag #CloudGarage WordPress:コンテナクローン WordPress1のクローン作成 名前 :WordPress サービスリンク :MySQL2
> mysql Instahce01 Instance02 Instance03
Page 32 hashtag #CloudGarage WordPress:コンテナクローン WordPress1のクローン作成
Page 33 Instance-01 Instance-02 Instance-03 Replication 最終ゴール DB (Rancher-Server) DB
(Rancher-Server) DB (Rancher-Server) Docker-container RANCHER-Server Docker-container RANCHER-Server Docker-container RANCHER-Server 第3牧場で「たぬき」を飼う
Service Site Facebook Twitter hashtag https://cloudgarage.jp @CloudGarage.PR @CloudGarage_PR #CloudGarage