Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GitLab-CI でPrivate Registry を利用する話

GitLab-CI でPrivate Registry を利用する話

20210528 DockerCon 2021 & Docker Meetup Tokyo #35 でLTした話です。

athagi

May 28, 2021
Tweet

More Decks by athagi

Other Decks in Technology

Transcript

  1. 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/ 

  2. 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/ 

  3. 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)
  4. 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

  5. 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

  6. Point
 • 利用者がイメージを利用する際は Credential を意識する必要 がない
 • ECR の認証は ecr-credential-helper

    & Instance Profile
 • Official Image が Docker Hub だけにあり、パブリックレジストリ にないイメージは運用を考える必要があるった

  7. まとめ
 • docker-machine はメンテナンスモードなので GitLab-CI では Fork して利用
 • client

    側で token を取得して docker run 時に host に一緒に 渡している
 • docker-credential-helper を利用することで透過的に利用でき るようになる

  8. 参考資料
 • 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