How do I get Docker registry username and password in gitlab.com?
Asked Answered
G

2

5

I want to login to Docker Registry in Gitlab.com using Ansible play, but how do I get Docker Registry username and password in gitlab?

Is it same as gitlab.com username and password?

Gaylegayleen answered 8/9, 2018 at 11:23 Comment(2)
When you say docker registry, which registry are you referring to? Docker Hub or GitLab's own registry?Spinet
Because of the vast amount of information on the internet and Stack Overflow, it often takes just a simple search or two to find them. Please include the research that you have done and what you have tried.Sowell
D
6

Registry credentials in GitLab are the same as the repositories they belong to. So, you can use your GitLab.com username and password.

That said, you should probably create a personal access token with only read_registry permissions to use with Ansible, instead of literally using your account credentials, to limit what Ansible can do. And, you can revoke the token if it leaks.

Documentation: Personal access tokens

Danuloff answered 8/9, 2018 at 23:6 Comment(0)
A
0

Though there is an accepted answer using personal access token, we can do this by using a Deploy token as well.

Main difference between Personal Access Token and Deploy Token are to use personal access token, you need to have a Gitlab account (username & pwd) to use with personal access token and it can be used to authenticate with GitLab API as well.

In otherhand Deploy tokens allow you to download (git clone) or push and pull packages and container registry images of a project without having a user and a password. Deploy tokens cannot be used with the GitLab API.

To create a deploy token go to

Project settings >> Repository >> Deploy tokens

Then you can give token name, expiration date, username and scopes for the token.

enter image description here

You can refer more about Gitlab tokens here.

Aether answered 5/4, 2024 at 13:12 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.