Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to use gitlab deploy token in docker image?


Asked by Roy Walls on Dec 04, 2021 Docker



Using the GitLab Deploy Token: You can create and use a special deploy token with your private projects. It provides read-only (pull) access to the Registry. Once created, you can use the special environment variables, and GitLab CI/CD will fill them in for you.
Just so,
Want to use an image from a private Docker registry as the base for GitLab Runner’s Docker executor? Assuming the image exists on the registry, you can set the DOCKER_AUTH_CONFIG variable within your project’s Settings > CI/CD page:
Moreover, 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 can be managed by maintainers only. Deploy tokens cannot be used with the GitLab API.
In respect to this,
You can do that in Settings > CI / CD > Variables. In the same location, save the DOCKER_HOST_IP variable, that stores the server’s IP address. The last line in the SSH configuration skips the interactive SSH host key check. The actual deploy part uses docker-compose, so it requires docker-compose.yml.
Also Know,
A DOCKER_AUTH_CONFIG variable provided as either: A CI/CD variable in the.gitlab-ci.yml file. A project’s variables stored on the project’s Settings > CI/CD page. A DOCKER_AUTH_CONFIG variable provided as environment variable in the runner’s config.toml file.