Skip to content

Update Docker image semver tags in a Docker Compose file to the latest semver tags.

License

Notifications You must be signed in to change notification settings

arifer612/docker-tag-updater

Repository files navigation

Docker Tag Updater

https://img.shields.io/badge/license-GPL_3-green.svg https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg

Update Docker image semver tags in a Docker Compose file to the latest semver tags.

Depedencies

When run locally, this project requires the following dependencies:

Otherwise, when run as a Docker container, there is no need to worry about these dependencies.

Usage

Let us begin with an example compose file named compose.yaml

$ cat /home/user/examples/compose.yaml
>> ---
>> services
>> ...
>>   service-to-update
>>     image: registry.io/john-doe/hello-world:v1.2.2
>> ...

Assume that we want to update the image john-doe/hello-world hosted on the registry registry.io with the tag develop, i.e., we want to match the semantic version of registry.io/john-doe/hello-world:develop. To accomplish this, we can do one of the following:

Using the updater script

Clone this repository, install the dependencies, and run the script.

git clone https://github.com/arifer612/docker-tag-updater
cd docker-tag-updater
poetry install --only main
poetry run ./compose-updater.sh -t develop -f /home/user/examples/compose.yaml \
       registry.io/john-doe/hello-world

Using Docker

To update the image john-doe/hello-world hosted on the registry registry.io with the tag develop, i.e., you want to match the semantic version of registry.io/john-doe/hello-world:develop, you can do the following:

$ cd /home/user/examples && \
    docker run --rm ghcr.io/arifer612/docker-tag-updater \
           registry.io/john-doe/hello-world develop