<commit_before>---
title: Docker
description: Docker Package Manager Support in Renovate
---

# Docker

Renovate supports upgrading dependencies in various types of Docker definition files:

- Docker's `Dockerfile` files
- Docker Compose files
- CircleCI config files
- Kubernetes manifests
- Ansible configuration files

## How It Works

1.  Renovate will search each repository for any files matching each manager's configured `fileMatch` pattern(s)
2.  Files that match the pattern(s) are parsed and checked to see if they contain any Docker image references (e.g. `FROM` lines in a `Dockerfile`)
3.  If the image tag in use "looks" like a semver (e.g. `node:12`, `node:12.1`, `node:12.1.0`, `node:12-onbuild`) then Renovate will look up the Docker registry to determine if any upgrades are available (e.g. `node:12.2.0`).

## Preservation of Version Precision

Renovate by default will preserve the precision of Docker images. For example if the existing image is `node:12.1` then Renovate would only propose upgrades to `node:12.2` or `node:12.3` and not to more specified versions like `node:12.2.0` or `node:12.3.0`. Renovate does not yet support "pinning" an imprecise version to a precise version, e.g. from `node:12.2` to `node:12.2.0`, however it's a feature we'd like to implement one day.

## Version compatibility

Although suffixes in semver indicate pre-releases (e.g. `v1.2.0-alpha.2`), in Docker they typically indicate compatibility, e.g. `12.2.0-alpine`. Renovate defaults to assuming suffixes indicate compatibility so will never _change_ it. e.g. `12.1.0-alpine` might get updated to `12.1.1-alpine` but never `12.1.1` or `12.1.1-stretch`.

If this behaviour does not suit a particular package you have, Renovate allows you to customize the `versionScheme` in use. For example, if you have a Docker image `foo/bar` that sticks to semver versioning and you need Renovate to understand that suffixes indicate pre-releases versions and not compatibility, then you could configure this pacckage rule:

```json
{
  "packageRules": [
    {
      "datasources": ["docker"],
      "packageNames": ["foo/bar"],
      "versionScheme": "semver"
    }
  ]
}
```

Another example is the official `python` image, which follows `pep440` versioning. You can configure that with another package rule:

```json
{<commit_msg>style: correct typo (#5049)<commit_after>---
title: Docker
description: Docker Package Manager Support in Renovate
---

# Docker

Renovate supports upgrading dependencies in various types of Docker definition files:

- Docker's `Dockerfile` files
- Docker Compose files
- CircleCI config files
- Kubernetes manifests
- Ansible configuration files

## How It Works

1.  Renovate will search each repository for any files matching each manager's configured `fileMatch` pattern(s)
2.  Files that match the pattern(s) are parsed and checked to see if they contain any Docker image references (e.g. `FROM` lines in a `Dockerfile`)
3.  If the image tag in use "looks" like a semver (e.g. `node:12`, `node:12.1`, `node:12.1.0`, `node:12-onbuild`) then Renovate will look up the Docker registry to determine if any upgrades are available (e.g. `node:12.2.0`).

## Preservation of Version Precision

Renovate by default will preserve the precision of Docker images. For example if the existing image is `node:12.1` then Renovate would only propose upgrades to `node:12.2` or `node:12.3` and not to more specified versions like `node:12.2.0` or `node:12.3.0`. Renovate does not yet support "pinning" an imprecise version to a precise version, e.g. from `node:12.2` to `node:12.2.0`, however it's a feature we'd like to implement one day.

## Version compatibility

Although suffixes in semver indicate pre-releases (e.g. `v1.2.0-alpha.2`), in Docker they typically indicate compatibility, e.g. `12.2.0-alpine`. Renovate defaults to assuming suffixes indicate compatibility so will never _change_ it. e.g. `12.1.0-alpine` might get updated to `12.1.1-alpine` but never `12.1.1` or `12.1.1-stretch`.

If this behaviour does not suit a particular package you have, Renovate allows you to customize the `versionScheme` in use. For example, if you have a Docker image `foo/bar` that sticks to semver versioning and you need Renovate to understand that suffixes indicate pre-releases versions and not compatibility, then you could configure this package rule:

```json
{
  "packageRules": [
    {
      "datasources": ["docker"],
      "packageNames": ["foo/bar"],
      "versionScheme": "semver"
    }
  ]
}
```

Another example is the official `python` image, which follows `pep440` versioning. You can configure that with another package rule:

```json
{
{'fraction_non_alphanumeric': 0.09723709573784536, 'fraction_numerical': 0.03041336474619833, 'mean_word_length': 4.223713646532438, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '470223', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1359, 'n_words': 617}