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
athagi
May 28, 2021
Technology
1.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
570
petなEC2をまとめて監視してみた
athagi
1
280
既存の仕組みを棄てる技術
athagi
0
820
冴えない開発環境の育てかた
athagi
0
110
Kubernetes がない世界の CloudNative ジャーニー
athagi
0
450
ゆるキャンはじめました。
athagi
0
1.7k
Windows Server にAnsibleを使ってみた話
athagi
2
2.2k
Other Decks in Technology
See All in Technology
200個のGitHubリポジトリを横断調査したかった
icck
0
120
就職⽀援サービスにおけるキャリアアドバイザーのシフトスケジューリング
recruitengineers
PRO
1
140
失敗を経て、Harness Engineering で 大切にしたいことを考える / Learning from Failure: What Matters in Harness Engineering
bitkey
PRO
1
350
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
950
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
570
2026TECHFRESH畢業分享會 - Lightning Talk - 資料也要 CI/CD? 用 Airbyte 自動化資料同步
line_developers_tw
PRO
0
940
白金鉱業Meetup_Vol.24_「AIエージェントは分けるほど良い」は本当か? / Is it true that “the more you divide AI agents, the better”?
brainpadpr
1
360
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
130
やさしいA2A入門
minorun365
PRO
12
1.8k
非定型業務をAI slackbotで自動化する ~ 社内要望を自動壁打ちするbotを作った ~/automating-ad-hoc-work-with-ai-slackbot
shibayu36
0
640
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.3k
【Cyber-sec+】経営層を"動かす"ための考え方
hssh2_bin
0
170
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
270
Design in an AI World
tapps
1
240
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How GitHub (no longer) Works
holman
316
150k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
200
How to train your dragon (web standard)
notwaldorf
97
6.7k
Everyday Curiosity
cassininazir
0
230
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
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