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
0
1.4k
GitLab-CI でPrivate Registry を利用する話
20210528 DockerCon 2021 & Docker Meetup Tokyo #35 でLTした話です。
athagi
May 28, 2021
Tweet
Share
More Decks by athagi
See All by athagi
社内でAWS GameDayを開催しよう
athagi
2
420
petなEC2をまとめて監視してみた
athagi
1
200
既存の仕組みを棄てる技術
athagi
0
720
冴えない開発環境の育てかた
athagi
0
78
Kubernetes がない世界の CloudNative ジャーニー
athagi
0
350
ゆるキャンはじめました。
athagi
0
1.6k
Windows Server にAnsibleを使ってみた話
athagi
2
2k
Other Decks in Technology
See All in Technology
Ruby on Railsで持続可能な開発を行うために取り組んでいること
am1157154
3
140
RayでPHPのデバッグをちょっと快適にする
muno92
PRO
0
190
MIMEと文字コードの闇
hirachan
2
1.4k
データエンジニアリング領域におけるDuckDBのユースケース
chanyou0311
9
2.2k
日経のデータベース事業とElasticsearch
hinatades
PRO
0
230
PHPカンファレンス名古屋-テックリードの経験から学んだ設計の教訓
hayatokudou
2
540
EMConf JP 2025 懇親会LT / EMConf JP 2025 social gathering
sugamasao
2
190
4th place solution Eedi - Mining Misconceptions in Mathematics
rist
0
140
Aurora PostgreSQLがCloudWatch Logsに 出力するログの課金を削減してみる #jawsdays2025
non97
1
190
IAMポリシーのAllow/Denyについて、改めて理解する
smt7174
2
200
偏光画像処理ライブラリを作った話
elerac
1
170
データベースの負荷を紐解く/untangle-the-database-load
emiki
2
500
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
Being A Developer After 40
akosma
89
590k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
640
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Designing Experiences People Love
moore
140
23k
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