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
0
1.6k
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
550
petなEC2をまとめて監視してみた
athagi
1
260
既存の仕組みを棄てる技術
athagi
0
810
冴えない開発環境の育てかた
athagi
0
100
Kubernetes がない世界の CloudNative ジャーニー
athagi
0
430
ゆるキャンはじめました。
athagi
0
1.7k
Windows Server にAnsibleを使ってみた話
athagi
2
2.2k
Other Decks in Technology
See All in Technology
AIエージェント勉強会第3回 エージェンティックAIの時代がやってきた
ymiya55
0
120
How to install a gem
indirect
0
1.4k
プログラミング不要! テスト自動化における生成AI使いこなし術
magicpod
1
110
Phase02_AI座学_応用
overflowinc
0
2.7k
Copilot 宇宙へ 〜生成AIで「専門データの壁」を壊す方法〜
nakasho
0
180
Why we keep our community?
kawaguti
PRO
0
190
BFCacheを活用して無限スクロールのUX を改善した話
apple_yagi
0
120
From Senior to Staff : To infinity and beyond !
kuahyeow
0
110
Kubernetesの「隠れメモリ消費」によるNode共倒れと、Request適正化という処方箋
g0xu
0
110
Navigation APIと見るSvelteKitのWeb標準志向
yamanoku
2
110
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
230
開発チームとQAエンジニアの新しい協業モデル -年末調整開発チームで実践する【QAリード施策】-
qa
0
270
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
270
Embracing the Ebb and Flow
colly
88
5k
So, you think you're a good person
axbom
PRO
2
2k
How to Ace a Technical Interview
jacobian
281
24k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
840
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.4k
Designing Experiences People Love
moore
143
24k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
240
Between Models and Reality
mayunak
2
240
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
200
GitHub's CSS Performance
jonrohan
1032
470k
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