watchtower icon indicating copy to clipboard operation
watchtower copied to clipboard

Filter by image registry

Open feg545 opened this issue 8 months ago โ€ข 1 comments

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Current Watchtower Capabilities

Watchtower currently supports the following container selection strategies:

  • Monitoring all containers
  • Monitoring containers by label
  • Excluding containers using the disable-container label

Use Case

In a typical microservices project, I use Watchtower for continuous deployment. The project includes the following images or containers:

  • mysql
  • redis
  • registry.mycompany.com/myproject/backend
  • registry.mycompany.com/myproject/web

Problem

When deploying with docker stack, the container names are dynamically generated, making the disable-by-container-name method unusable.

Using labels to distinguish containers is feasible but requires modifying my docker-compose.yml, which is a bit cumbersome.

Suggestion

I would like Watchtower to support filtering based on image repository prefixes, such as filtering by registry.mycompany.com. These are our own custom images that should be auto-updated, while images like mysql and redis from the official Docker Hub donโ€™t need to be updated frequently.

Proposed Design

I suggest that Watchtower introduces an environment variable to filter by image name before pulling. The filter should support:

  • Comma-separated multiple filters
  • Regular expression matching (preferred)

Example usage:

WATCHTOWER_IMAGE_FILTER=^registry.mycompany.com, /myproject/

Describe alternatives you've considered

No

Additional context

No response

feg545 avatar May 08 '25 05:05 feg545

Hi there! ๐Ÿ‘‹๐Ÿผ As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! ๐Ÿ™

github-actions[bot] avatar May 08 '25 05:05 github-actions[bot]