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?
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?
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
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.
You can refer more about Gitlab tokens here.
© 2022 - 2025 — McMap. All rights reserved.