2017-12-25 15:22:13 +00:00
---
title: Docker
description: Docker Package Manager Support in Renovate
---
2018-05-02 19:53:49 +00:00
# Docker
2018-08-04 06:23:15 +00:00
Renovate supports upgrading dependencies in various types of Docker definition files:
2018-06-25 08:57:38 +00:00
2018-08-04 06:23:15 +00:00
- Docker's `Dockerfile` files
2022-05-10 15:48:01 +00:00
- Docker Compose `docker-compose.yml` , `compose.yml` files
2024-04-25 07:36:21 +00:00
- Visual Studio Code dev containers and GitHub Codespaces images and features
2018-08-04 06:23:15 +00:00
- CircleCI config files
2020-12-12 19:57:38 +00:00
- Kubernetes manifest files
2019-12-08 15:46:43 +00:00
- Ansible configuration files
2017-12-25 15:22:13 +00:00
## How It Works
2020-12-12 19:57:38 +00:00
1. Renovate searches in each repository for any files matching each manager's configured `fileMatch` pattern(s)
2022-03-16 13:50:20 +00:00
1. Matching files are parsed, Renovate checks if the file(s) has any Docker image references (e.g. `FROM` lines in a `Dockerfile` )
2020-12-12 19:57:38 +00:00
1. If the image tag in use "looks" like a version (e.g. `myimage:1` , `myimage:1.1` , `myimage:1.1.0` , `myimage:1-onbuild` ) then Renovate checks the Docker registry for upgrades (e.g. from `myimage:1.1.0` to `myimage:1.2.0` )
2019-12-08 15:46:43 +00:00
## Preservation of Version Precision
2020-12-12 19:57:38 +00:00
By default, Renovate preserves the precision level specified in the Docker images.
For example, if the existing image is pinned at `myimage:1.1` then Renovate only proposes upgrades to `myimage:1.2` or `myimage:1.3` .
This means that you will not get upgrades to a more specific versions like `myimage:1.2.0` or `myimage:1.3.0` .
2022-03-28 19:25:49 +00:00
Renovate does not yet support "pinning" an imprecise version to a precise version, e.g. from `myimage:1.2` to `myimage:1.2.0` , but it's a feature we'd like to work on one day.
2019-12-08 15:46:43 +00:00
## Version compatibility
2020-12-12 19:57:38 +00:00
Although suffixes in SemVer indicate pre-releases (e.g. `v1.2.0-alpha.2` ), in Docker they typically indicate compatibility, e.g. `1.2.0-alpine` .
By default Renovate assumes suffixes indicate compatibility, for this reason Renovate will not _change_ any suffixes.
Renovate will update `1.2.0-alpine` to `1.2.1-alpine` but never updates to `1.2.1` or `1.2.1-stretch` as that would change the suffix.
2019-12-08 15:46:43 +00:00
2020-12-12 19:57:38 +00:00
If this behavior does not suit a particular package you have, Renovate allows you to customize the `versioning` scheme it uses.
For example, you have a Docker image `foo/bar` that sticks to SemVer versioning.
This means that you need to tell Renovate that suffixes indicate pre-release versions, and not compatibility.
You could then use this `packageRules` array, to tell Renovate to use `semver` versioning for the `foo/bar` package:
2019-12-08 15:46:43 +00:00
```json
{
"packageRules": [
{
2021-01-29 10:43:42 +00:00
"matchDatasources": ["docker"],
"matchPackageNames": ["foo/bar"],
2020-02-18 07:34:10 +00:00
"versioning": "semver"
2019-12-08 15:46:43 +00:00
}
]
}
```
2020-11-02 08:52:37 +00:00
Another example is the official `python` image, which follows `pep440` versioning.
2019-12-08 15:46:43 +00:00
2023-11-02 16:04:33 +00:00
```json title="Telling Renovate to use the pep440 versioning scheme"
2019-12-08 15:46:43 +00:00
{
"packageRules": [
{
2021-01-29 10:43:42 +00:00
"matchDatasources": ["docker"],
"matchPackageNames": ["python"],
2020-02-18 07:34:10 +00:00
"versioning": "pep440"
2019-12-08 15:46:43 +00:00
}
]
}
```
2020-12-12 19:57:38 +00:00
If traditional versioning doesn't work, try Renovate's built-in `loose` `versioning` .
2022-03-16 13:50:20 +00:00
Renovate will perform a best-effort sort of the versions, regardless of whether they have letters or digits.
2019-12-08 15:46:43 +00:00
2020-12-12 19:57:38 +00:00
If both the traditional versioning, and the `loose` versioning do not give the results you want, try the `regex` `versioning` .
This approach uses regex capture group syntax to specify which part of the version string is major, minor, patch, pre-release, or compatibility.
See the docs for `versioning` for documentation and examples of `regex` versioning in action.
2017-12-25 15:22:13 +00:00
## Digest Pinning
2020-12-12 19:57:38 +00:00
We recommend that you pin your Docker images to an exact digest.
2022-06-15 11:48:25 +00:00
By pinning to a digest you make your Docker builds immutable, every time you do a `pull` you get the same content.
2020-12-12 19:57:38 +00:00
2022-06-15 11:48:25 +00:00
If you work with dependencies in the JavaScript/npm ecosystem, you may be used to exact versions being immutable.
For example, if you set a version like `2.0.1` , you and your colleagues always get the exact same "code".
2017-12-25 15:22:13 +00:00
2022-06-15 11:48:25 +00:00
Docker's tags are not immutable versions, even if tags _look_ like a version.
You probably expect `myimage:1` and `myimage:1.2` to change over time, but you might incorrectly assume that `myimage:1.2.0` never changes.
2020-11-02 08:52:37 +00:00
Although it probably _shouldn't_ , the reality is that any Docker image tag _can_ change content, and potentially break.
2017-12-25 15:22:13 +00:00
2022-06-15 11:48:25 +00:00
By replacing Docker tags with Docker digests as the image's primary identifier you'll get immutable builds.
2023-05-29 08:20:40 +00:00
Working with strings like `FROM node@sha256:d938c1761e3afbae9242848ffbb95b9cc1cb0a24d889f8bd955204d347a7266e` is hard.
Luckily Renovate can update the digests for you.
2017-12-25 15:22:13 +00:00
2023-05-29 08:20:40 +00:00
When pinning a digest, Renovate retains the Docker tag in the `FROM` line for readability, like this: `FROM node:14.15.1@sha256:d938c1761e3afbae9242848ffbb95b9cc1cb0a24d889f8bd955204d347a7266e` .
2017-12-25 15:22:13 +00:00
## Digest Updating
2023-05-29 08:20:40 +00:00
If you follow our advice to replace a tag like `node:14` with a pinned digest like `node:14@sha256:d938c1761e3afbae9242848ffbb95b9cc1cb0a24d889f8bd955204d347a7266e` , you will get Renovate PRs whenever the `node:14` image is updated on Docker Hub.
2017-12-25 15:22:13 +00:00
2022-06-15 11:48:25 +00:00
Previously this update would have been "invisible" to you - one day you pull code that represents `node:14.15.0` and the next day you pull code that represents `node:14.15.1` .
2020-11-02 08:52:37 +00:00
But you can never be sure, especially as Docker caches.
2022-06-15 11:48:25 +00:00
Maybe some of your colleagues, or worse still your build machine, are stuck on an older version with a security vulnerability.
2017-12-25 15:22:13 +00:00
2022-02-07 14:53:22 +00:00
By pinning to a digest instead, you will get these updates via Pull Requests, or even committed directly to your repository if you enable branch automerge for convenience.
2022-06-15 11:48:25 +00:00
This makes sure everyone on your team uses the latest versions.
2017-12-25 15:22:13 +00:00
## Version Upgrading
2023-07-12 12:17:24 +00:00
Renovate also supports _upgrading_ versions in Docker tags, so from `myimage:1.2.0` to `myimage:1.2.1` , or from `myimage:1.2` to `myimage:1.3` .
2020-12-12 19:57:38 +00:00
If a tag looks like a version, Renovate will upgrade it like a version.
2017-12-25 15:22:13 +00:00
2023-07-12 12:17:24 +00:00
We recommend you use the `major.minor.patch` tagging scheme, so change `myimage:1` to `myimage:1.1.1` first.
This way you can see the changes in Renovate PRs.
2022-06-15 11:48:25 +00:00
You can see the difference between a PR that upgrades `myimage` from `1.1.1` to `1.1.2` and a PR that changes the contents of the version you already use (`1.1.1`).
2017-12-25 15:22:13 +00:00
2023-07-12 12:17:24 +00:00
By default, Renovate will upgrade `minor` and `patch` versions, so from `1.2.0` to `1.2.1` , but _not_ upgrade `major` versions.
If you wish to enable `major` versions: add the preset `docker:enableMajor` to the `extends` array in your `renovate.json` file.
2017-12-25 15:22:13 +00:00
2020-12-12 19:57:38 +00:00
Renovate has some Docker-specific intelligence when it comes to versions.
2020-11-02 08:52:37 +00:00
For example:
2017-12-25 15:22:13 +00:00
2022-03-24 10:54:21 +00:00
### Ubuntu codenames
2023-07-12 12:17:24 +00:00
Renovate understands [Ubuntu release code names ](https://wiki.ubuntu.com/Releases ) and will offer upgrades to the latest LTS release.
2022-03-24 10:54:21 +00:00
2023-07-12 12:17:24 +00:00
You must only use the _first_ term of the code name in _lowercase_ .
2024-04-29 15:14:21 +00:00
So use `noble` for the Noble Numbat release.
2022-03-24 10:54:21 +00:00
For example, Renovate will offer to upgrade the following `Dockerfile` layer:
2023-07-12 12:17:24 +00:00
```diff
2024-04-29 15:14:21 +00:00
- FROM ubuntu:jammy
+ FROM ubuntu:noble
2022-03-24 10:54:21 +00:00
```
2022-05-18 15:32:59 +00:00
### Debian codenames
2023-07-12 12:17:24 +00:00
Renovate understands [Debian release code names and rolling updates schedule ](https://wiki.debian.org/DebianReleases ) and will offer upgrades to the latest stable release.
For example from `debian:bullseye` to `debian:bookworm` .
2022-05-18 15:32:59 +00:00
2023-07-12 12:17:24 +00:00
The Debian codename must be in _lowercase_ .
2022-05-18 15:32:59 +00:00
For example, Renovate will offer to upgrade the following `Dockerfile` layer:
2023-07-12 12:17:24 +00:00
```diff
- FROM debian:bullseye
+ FROM debian:bookworm
2022-05-18 15:32:59 +00:00
```
2017-12-25 15:22:13 +00:00
## Configuring/Disabling
2020-11-02 08:52:37 +00:00
If you wish to make changes that apply to all Docker managers, then add them to the `docker` config object.
2020-12-12 19:57:38 +00:00
This is not foolproof, because some managers like `circleci` and `ansible` support multiple datasources that do not inherit from the `docker` config object.
2019-12-08 15:46:43 +00:00
2020-11-02 08:52:37 +00:00
If you wish to override Docker settings for one particular type of manager, use that manager's config object instead.
2020-12-12 19:57:38 +00:00
For example, to disable digest updates for Docker Compose only but leave them for other managers like `Dockerfile` , you would use this:
2018-08-23 16:46:49 +00:00
```json
2021-11-11 10:11:55 +00:00
{
2018-08-23 16:46:49 +00:00
"docker-compose": {
"digest": {
"enabled": false
}
}
2021-11-11 10:11:55 +00:00
}
2018-08-23 16:46:49 +00:00
```
2017-12-25 15:22:13 +00:00
The following configuration options are applicable to Docker:
2020-12-12 19:57:38 +00:00
### Disable all Docker Renovation
2017-12-25 15:22:13 +00:00
Add `"docker:disable"` to your `extends` array.
2020-12-12 19:57:38 +00:00
### Disable Renovate for only certain Dockerfiles
2017-12-25 15:22:13 +00:00
Add all paths to ignore into the `ignorePaths` configuration field. e.g.
2018-08-04 06:23:15 +00:00
```json
{
2023-06-27 12:26:57 +00:00
"extends": ["config:recommended"],
2017-12-25 15:22:13 +00:00
"ignorePaths": ["docker/old-files/"]
2018-08-04 06:23:15 +00:00
}
2017-12-25 15:22:13 +00:00
```
2020-12-12 19:57:38 +00:00
### Enable Docker major updates
2017-12-25 15:22:13 +00:00
Add `"docker:enableMajor"` to your `extends` array.
2020-12-12 19:57:38 +00:00
### Disable digest pinning
2017-12-25 15:22:13 +00:00
Add `"default:pinDigestsDisabled"` to your `extends` array.
2020-12-12 19:57:38 +00:00
### Automerge digest updates
2017-12-25 15:22:13 +00:00
2020-11-02 08:52:37 +00:00
Add `"default:automergeDigest"` to your `extends` array.
2020-12-12 19:57:38 +00:00
If you want Renovate to commit directly to your base branch without opening a PR first, add `"default:automergeBranchPush"` to the `extends` array.
2018-08-05 05:26:06 +00:00
2020-12-12 19:57:38 +00:00
### Registry authentication
2018-08-05 05:26:06 +00:00
2021-01-18 17:30:30 +00:00
There are many different registries, and many ways to authenticate to those registries.
We will explain how to authenticate for the most common registries.
#### DockerHub
2020-12-12 19:57:38 +00:00
Here is an example of configuring a default Docker username/password in `config.js` .
The Docker Hub password is stored in a process environment variable.
2018-08-05 05:26:06 +00:00
2023-11-02 16:04:33 +00:00
```js title="config.js"
2018-08-05 05:26:06 +00:00
module.exports = {
2018-09-12 10:16:17 +00:00
hostRules: [
2018-08-05 05:26:06 +00:00
{
2019-05-21 11:20:09 +00:00
hostType: 'docker',
2018-08-05 05:26:06 +00:00
username: '< your-username > ',
2021-01-21 19:44:49 +00:00
password: process.env.DOCKER_HUB_PASSWORD,
2018-08-05 05:26:06 +00:00
},
],
};
```
2018-08-05 05:39:38 +00:00
2023-08-22 12:07:21 +00:00
You can add more host rules, read the [`hostRules` documentation ](./configuration-options.md#hostrules ) for more information.
2020-12-12 19:57:38 +00:00
2021-01-18 17:30:30 +00:00
#### Self-hosted Docker registry
2020-12-12 19:57:38 +00:00
Say you host some Docker images yourself, and use a password to access your self-hosted Docker images.
In addition to self-hosting, you also pull images from Docker Hub, without a password.
In this example you would configure a specific Docker host like this:
2019-08-05 12:54:20 +00:00
```js
module.exports = {
hostRules: [
{
hostType: 'docker',
2021-05-13 20:53:18 +00:00
matchHost: 'your.host.io',
2019-08-05 12:54:20 +00:00
username: '< your-username > ',
2021-01-21 19:44:49 +00:00
password: process.env.SELF_HOSTED_DOCKER_IMAGES_PASSWORD,
2019-08-05 12:54:20 +00:00
},
],
};
```
2019-12-08 15:46:43 +00:00
2022-12-23 19:34:21 +00:00
#### AWS ECR (Amazon Web Services Elastic Container Registry)
2024-08-13 12:07:21 +00:00
##### Using access key id & secret
2024-07-07 09:20:44 +00:00
2022-12-23 19:34:21 +00:00
Renovate can authenticate with AWS ECR using AWS access key id & secret as the username & password, for example:
```json
2022-12-23 20:10:07 +00:00
{
"hostRules": [
2022-12-23 19:34:21 +00:00
{
"hostType": "docker",
"matchHost": "12345612312.dkr.ecr.us-east-1.amazonaws.com",
"username": "AKIAABCDEFGHIJKLMNOPQ",
"encrypted": {
"password": "w...A"
}
}
]
2022-12-23 20:10:07 +00:00
}
2022-12-23 19:34:21 +00:00
```
2024-07-07 09:20:44 +00:00
##### Using `get-login-password`
Renovate can also authenticate with AWS ECR using the output from the `aws ecr get-login-password` command as outlined in
the [AWS documentation ](https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html#registry-auth-token ).
To make use of this authentication mechanism, specify the username as `AWS` :
```json
{
"hostRules": [
{
"hostType": "docker",
"matchHost": "12345612312.dkr.ecr.us-east-1.amazonaws.com",
"username": "AWS",
"encrypted": {
"password": "w...A"
}
}
]
}
```
2022-06-22 08:31:06 +00:00
#### Google Container Registry / Google Artifact Registry
2024-08-24 06:40:45 +00:00
##### Using Workload Identity
To let Renovate authenticate with [Workload Identity ](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity ), you must:
- Configure Workload Identity
- Give the Service Account the `artifactregistry.repositories.downloadArtifacts` permission
###### With Application Default Credentials (self-hosted only)
To let Renovate authenticate with [ADC ](https://cloud.google.com/docs/authentication/provide-credentials-adc ), you must:
- Configure ADC as normal
- _Not_ provide a username, password or token
Renovate will get the credentials with the [`google-auth-library` ](https://www.npmjs.com/package/google-auth-library ).
###### With short-lived access token / GitHub Actions (self-hosted only)
```yaml title="Example for Workload Identity plus Renovate host rules"
- name: authenticate to google cloud
id: auth
2024-08-24 06:52:11 +00:00
uses: google-github-actions/auth@v2.1.5
2024-08-24 06:40:45 +00:00
with:
token_format: 'access_token'
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT }}
- name: renovate
2024-09-16 10:05:52 +00:00
uses: renovatebot/github-action@v40.2.9
2024-08-24 06:40:45 +00:00
env:
RENOVATE_HOST_RULES: |
[
{
matchHost: "us-central1-docker.pkg.dev",
hostType: "docker",
username: "oauth2accesstoken",
password: "${{ steps.auth.outputs.access_token }}"
}
]
with:
token: ${{ secrets.RENOVATE_TOKEN }}
configurationFile: .github/renovate.json5
```
2023-09-21 15:10:18 +00:00
2024-08-24 06:40:45 +00:00
You can find a full GitHub Workflow example on the [renovatebot/github-action ](https://github.com/renovatebot/github-action ) repository.
2023-09-21 15:10:18 +00:00
2022-06-22 08:31:06 +00:00
##### Using long-lived service account credentials
2022-06-22 10:37:26 +00:00
To access the Google Container Registry (deprecated) or the Google Artifact Registry, use the JSON service account with `Basic` authentication, and use the:
2022-06-22 08:31:06 +00:00
2022-06-22 10:37:26 +00:00
- `_json_key` as username
- full Google Cloud Platform service account JSON as password
2022-06-22 08:31:06 +00:00
2022-06-22 10:37:26 +00:00
To avoid JSON-in-JSON wrapping, which can cause problems, encode the JSON service account beforehand.
2022-06-22 08:31:06 +00:00
2022-06-22 10:37:26 +00:00
Google Container Registry does not natively support `_json_key_base64` and a base64 encoded service account.
Google Artifact Registry supports `_json_key_base64` and a base64 encoded service account natively.
If all your dependencies are on the Google Artifact Registry, you can base64 encode and use the service account directly:
1. Download your JSON service account and store it on your machine. Make sure that the service account has `read` (and only `read` ) permissions to your artifacts
1. Base64 encode the service account credentials by running `cat service-account.json | base64`
2022-06-22 08:31:06 +00:00
1. Add the encoded service account to your configuration file
1. If you want to add it to your self-hosted configuration file:
```json
{
"hostRules": [
{
"matchHost": "europe-docker.pkg.dev",
"username": "_json_key_base64",
"password": "< base64 service account > "
}
]
}
```
2023-05-31 15:52:30 +00:00
1. If you want to add it to your repository Renovate configuration file, [encrypt ](./configuration-options.md#encrypted ) it and then add it:
2022-06-22 08:31:06 +00:00
```json
{
"hostRules": [
{
"matchHost": "europe-docker.pkg.dev",
"username": "_json_key_base64",
"encrypted": {
"password": "< encrypted base64 service account > "
}
}
]
}
```
If you have dependencies on Google Container Registry (and Artifact Registry) you need to use `_json_key` and a slightly different encoding:
2022-06-22 10:37:26 +00:00
1. Download your JSON service account and store it on your machine. Make sure that the service account has `read` (and only `read` ) permissions to your artifacts
2022-06-22 08:31:06 +00:00
1. Open the file and prefix the content with `_json_key:` . The file should look like this:
```
_json_key:{
"type": "service_account",
"project_id": "sample-project",
"private_key_id": "5786ff7e615522b932a2a37b4a6f9645c4316dbd",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDaOkxZut9uDUHV\n...\n/PWs0Wa2z5+IawMD7nO63+b6\n-----END PRIVATE KEY-----\n",
"client_email": "renovate-lookup@sample-project.iam.gserviceaccount.com",
"client_id": "115429165445403928973",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/renovate-lookup%40sample-project.iam.gserviceaccount.com"
}
```
2022-06-22 10:37:26 +00:00
1. Base64 encode the prefixed service account credentials by running `cat prefixed-service-account.json | base64`
2022-06-22 08:31:06 +00:00
1. Add the prefixed and encoded service account to your configuration file
1. If you want to add it to your self-hosted configuration file:
```json
{
"hostRules": [
{
"matchHost": "europe-docker.pkg.dev",
"authType": "Basic",
"token": "< base64 prefixed service account > "
}
]
}
```
2023-05-31 15:52:30 +00:00
1. If you want to add it to your repository Renovate configuration file, [encrypt ](./configuration-options.md#encrypted ) it and then add it:
2022-06-22 08:31:06 +00:00
```json
{
"hostRules": [
{
"matchHost": "europe-docker.pkg.dev",
"authType": "Basic",
"encrypted": {
"token": "< encrypted base64 prefixed service account > "
}
}
]
}
```
2024-08-24 06:40:45 +00:00
##### Using short-lived access token / Gitlab CI / Google Cloud
2021-06-16 20:22:32 +00:00
2024-08-26 09:55:30 +00:00
For this example, assume that you want to:
2021-06-16 20:22:32 +00:00
2024-08-26 09:55:30 +00:00
- Run the GitLab CI in the Google Cloud
- Store your Docker images in the Google Container Registry (GCR)
2021-06-16 20:22:32 +00:00
2024-08-26 09:55:30 +00:00
###### Accessing the Google Container Registry
2021-06-16 20:22:32 +00:00
2024-08-26 09:55:30 +00:00
Accessing the GCR uses Bearer token based authentication.
2021-06-16 20:22:32 +00:00
2024-08-26 09:55:30 +00:00
First, install the Google Cloud SDK.
Then get the token by running: `gcloud auth print-access-token` .
2021-06-16 20:22:32 +00:00
2024-08-26 09:55:30 +00:00
###### Short-lived GCR Bearer tokens
2021-06-16 20:22:32 +00:00
2024-08-26 09:55:30 +00:00
The GCR Bearer token expires after 60 minutes.
This means you can _not_ re-use the token in a later build.
Instead, _before_ Renovate starts in the GCR context, you must:
1. Fetch the Google access token
1. Inject the token into the `hostRules` configuration
The following text explains one way to fetch the token, and inject it into Renovate.
###### Basic approach
The basic approach is:
1. Create a custom image: fetch the GCR token, and inject the token into Renovate's `config.js` file
1. Then run Renovate as one of the stages of your project
###### Independent runs
To make the run independent of any user, use a [`Project Access Token` ](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html ).
Give the Project Access Token these scopes:
- `api`
- `read_api`
- `write_repository`
Then use the Project Access Token as the `RENOVATE_TOKEN` variable for GitLab CI.
For more (`gitlab-ci.yml`) configuration examples, see the [`renovate-runner` repository on GitLab ](https://gitlab.com/renovate-bot/renovate-runner ).
###### Create a custom image
To access the token, you need a custom Renovate Docker image.
Make sure to install the Google Cloud SDK into the custom image, as you need the `gcloud auth print-access-token` command later.
For example:
2021-06-16 20:22:32 +00:00
```Dockerfile
2024-09-16 00:07:30 +00:00
FROM renovate/renovate:38.80.0
2021-06-16 20:22:32 +00:00
# Include the "Docker tip" which you can find here https://cloud.google.com/sdk/docs/install
# under "Installation" for "Debian/Ubuntu"
RUN ...
```
2024-08-26 09:55:30 +00:00
###### Accessing the Google Container Registry (GCR)
Renovate needs the current Google Access Token to access the Google Container Registry (GCR).
Here's an example of how to set that up:
2021-06-16 20:22:32 +00:00
```js
hostRules: [
{
matchHost: 'eu.gcr.io',
token: 'MyReallySecretTokenThatExpiresAfter60Minutes',
},
];
```
2024-08-26 09:55:30 +00:00
One way to give Renovate the short-lived Google Access Token is to:
1. Write a script that generates a `config.js` file, with the token, in your `gitlab-ci.yml` file
1. Run the `config.js` creation scrip just before you start Renovate
For example:
2021-06-16 20:22:32 +00:00
```yaml
script:
- 'echo "module.exports = { hostRules: [ { matchHost: ''eu.gcr.io'', token: ''"$(gcloud auth print-access-token)"'' } ] };" > config.js'
- renovate $RENOVATE_EXTRA_FLAGS
```