Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GitLab-CI でPrivate Registry を利用する話
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
athagi
May 28, 2021
Technology
1.6k
0
Share
GitLab-CI でPrivate Registry を利用する話
20210528 DockerCon 2021 & Docker Meetup Tokyo #35 でLTした話です。
athagi
May 28, 2021
More Decks by athagi
See All by athagi
社内でAWS GameDayを開催しよう
athagi
2
560
petなEC2をまとめて監視してみた
athagi
1
270
既存の仕組みを棄てる技術
athagi
0
820
冴えない開発環境の育てかた
athagi
0
110
Kubernetes がない世界の CloudNative ジャーニー
athagi
0
440
ゆるキャンはじめました。
athagi
0
1.7k
Windows Server にAnsibleを使ってみた話
athagi
2
2.2k
Other Decks in Technology
See All in Technology
How to learn AWS Well-Architected with AWS BuilderCards: Security Edition
coosuke
PRO
0
150
SREの仕事は「壊さないこと」ではなくなった 〜自律化していくシステムに、責任と判断を与えるという価値〜 / 20260515 Naoki Shimada
shift_evolve
PRO
1
180
Terragrunt x Snowflake + dbt で作るマルチテナントなデータ基盤構築プラットフォーム
gak_t12
0
250
The Bag-of-Documents Model for Query Understanding and Retrieval
dtunkelang
0
140
LookerとADKで作る社内AIエージェント
chanyou0311
0
250
鹿野さんに聞く!CSSの最新トレンド Ver.2026
tonkotsuboy_com
6
3.5k
ECSのTerraformモジュールにコントリビュートした話
harukasakihara
0
220
サイボウズ、プラットフォームエンジニアリング始めるってよ ― プラットフォームチームの事業貢献と組織アラインメントの強化
ueokande
0
120
なぜ、私がCommunity Builderに?〜活動期間1か月半でも選出されたワケ〜
yama3133
0
140
データモデリング通り #5オンライン勉強会: AIに『ビジネスの文脈』を教え込むデータモデリング
datayokocho
0
290
Tachikawa.any 運営挨拶
daitasu
0
180
おいらのAWSアップデートの追い方〜Slack×AgentCore〜
yakumo
1
110
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
A designer walks into a library…
pauljervisheath
211
24k
Balancing Empowerment & Direction
lara
6
1.1k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Are puppies a ranking factor?
jonoalderson
1
3.4k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
550
Done Done
chrislema
186
16k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
370
How to Talk to Developers About Accessibility
jct
2
200
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.4k
The Spectacular Lies of Maps
axbom
PRO
1
740
Transcript
GitLab-CI で Private Registry を利用する話 USE TEMPLATE Click あさぎ(@_athagi) DockerCon
2021 & Docker Meetup Tokyo #35 (#dockertokyo)
GitLab-CI • GitLab 8.0 で本体に統合されたCICDツール • GitLab 12.x / 13.x
で機能強化 • yaml で書ける
Runner Manager docker pull git push docker-machine create
docker-machine • 2018年 メンテナンスモードに • GitLab ではFork して利用
Docker Hub rate limit が開始 • 2020年11月から • anonymous: 100pulls/6h
• IPアドレスに対して制限 • authenticated: 200pulls/6h https://www.docker.com/blog/scaling-docker-to-serve-millions-more-developers-network-egress/
Docker Hub rate limit が開始 • 2020年11月から • anonymous: 100pulls/6h
• IPアドレスに対して制限 • authenticated: 200pulls/6h https://www.docker.com/blog/scaling-docker-to-serve-millions-more-developers-network-egress/
Runner Manager docker pull git push
一瞬で rate limit 超過...
Runner Manager docker pull git push ecr public ecr
Private registry にログインする必要がある • docker login • ecr-credential-helper
実現したかったこと • CI を実行する際にECRのイメージを透過的に利用したい • CIで docker イメージの build &
push したい • できる限り管理するものは減らしたい
Runner Manager metadata service gitlab-runner ecr-credential-helper .ecr/cache.json docker-machine docker-machine create
dokcer run + payload config.toml (DOCKER_AUTH_CONFIG) docker.sock docker.sock awscli docker pull/push/login ECR read (Instance Profile)
Runner Manager metadata service gitlab-runner ecr-credential-helper .ecr/cache.json docker-machine docker-machine create
dokcer run + payload config.toml (DOCKER_AUTH_CONFIG) docker.sock docker.sock awscli docker pull/push/login ECR read (Instance Profile) pull
Runner Manager metadata service gitlab-runner ecr-credential-helper .ecr/cache.json docker-machine docker-machine create
dokcer run + token config.toml (DOCKER_AUTH_CONFIG) docker.sock docker.sock awscli docker pull/push/login ECR read (Instance Profile) build & push
Point • 利用者がイメージを利用する際は Credential を意識する必要 がない • ECR の認証は ecr-credential-helper
& Instance Profile • Official Image が Docker Hub だけにあり、パブリックレジストリ にないイメージは運用を考える必要があるった
うれしいニュース!!!
まとめ • docker-machine はメンテナンスモードなので GitLab-CI では Fork して利用 • client
側で token を取得して docker run 時に host に一緒に 渡している • docker-credential-helper を利用することで透過的に利用でき るようになる
参考資料 • docker-machine ◦ https://docs.docker.com/machine/ ◦ https://docs.docker.com/machine/drivers/aws/#options ◦
https://github.com/docker/machine/issues/4537#issue-341148889 • amazon-ecr-credential-helper ◦ https://github.com/awslabs/amazon-ecr-credential-helper • Autoscaling GitLab Runner on AWS EC2 ◦ https://docs.gitlab.com/runner/configuration/runner_autoscale_aws/ • Define an image from a private Container Registry ◦ https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#define-an-image-from-a-privat e-container-registry