Renovate supports upgrading dependencies in Docker's
Dockerfile files and Docker Compose files.
You can find the Docker Compose documentation here.
How It Works
- Renovate will search each repository for any files named (exactly)
- The first
FROMline will parsed
- If no digest is already in use then Renovate will raise a PR to "pin" that dependency to a Docker digest
- If the image tag in use "looks" like a semver (e.g.
node:8-onbuild) then Renovate will look up the Docker registry to determine if any upgrades are available (e.g.
Pinning your docker images to an exact digest is important for reasons of immutability. In short: so every time you
pull, you get the same content.
2.0.1 then you and your colleagues will always get the exact same "code". What you may not expect is that Docker's tags are not immutable versions even if they look like a version. e.g. you probably expect that
node:8.9 will change over time, but you might incorrectly assume that
node:8.9.0 would never change. Although it probably shouldn't, the reality is that it can.
Using a docker digest as the image's primary identifier instead of docker tag will achieve immutability but as a human it's quite inconvenient to deal with strings like
FROM node@sha256:552348163f074034ae75643c01e0ba301af936a898d778bb4fc16062917d0430. The good news is that, as a human you no longer need to manually update such digests once you have Renovate on the job.
Also, to retain some human-friendliness, Renovate will actually retain the tag in the
FROM line too, e.g.
FROM node:8@sha256:552348163f074034ae75643c01e0ba301af936a898d778bb4fc16062917d0430. Read on to see how Renovate keeps it up-to-date.
If you have followed our advice to go from tags like
node:8@sha256:552348163f074034ae75643c01e0ba301af936a898d778bb4fc16062917d0430, then you are likely to receive Renovate PRs whenever the
node:8 image is updated on Docker Hub.
Previously this would have been "invisible" to you - one day you pull code that represents
node:8.9.0 and the next day you get
node:8.9.1. But you can never be sure, especially as Docker caches. Perhaps some of your colleagues or worst still your build machine are stuck on an older version with a security vulnerability.
Instead, you will now receive these updates via Pull Requests, or perhaps committed directly to your repository if you enable branch automerge for convenience. This ensures everyone on the team gets the latest versions and is in sync.
Renovate also supports upgrading versions in Docker tags, e.g. from
node:8.9.1. If your tags looks like a version, Renovate will upgrade it like a version.
Thanks to this, you may wish to change the way you tag your image dependencies to be more specific, e.g. change from
node:8.9.1 so that every Renovate PR will be more human friendly, e.g. you can know that you are getting a PR because
node upgraded from
8.9.2 and not because
8.9.1 somehow changed.
Currently, Renovate will upgrade minor/patch versions (e.g. from
8.9 or from
8.9.1) by default, but not upgrade major versions. If you wish to enable major versions then add the preset
docker:enableMajor to your
extends array in your
Renovate has a some docker-specific intelligence when it comes to versions. For example:
- It understands that tag suffixes are frequently used, such as
node:8.9-onbuild. Renovate will only upgrade from/to the same suffix.
- It understands that some dependencies (e.g.
ubuntu) use even numbers for stable and odd for unstable. Renovate won't upgrade from stable unstable
The following configuration options are applicable to Docker:
Disable all Docker Renovation
"docker:disable" to your
Disable Renovate for only certain Dockerfiles
Add all paths to ignore into the
ignorePaths configuration field. e.g.
"extends": ["config:base"], ... "ignorePaths": ["docker/old-files/"]
Enable Docker major updates
"docker:enableMajor" to your
Disable digest pinning
"default:pinDigestsDisabled" to your
Automerge digest updates
"default:automergeDigest" to your
extends array. Also add
"default:automergeBranchPush" if you wish for these to be committed directly to your base branch without raising a PR first.
The following features are planned but not supported today:
- Custom Docker registries (only Docker Hub is currently supported)
If any of these features are important to you, please add a comment or at least a
+1 in Renovate's Issues Tracker.