How to synchronize version control system versions with Docker image versions?

What is a regular template for mapping Docker versions in the Docker and Git registry (for example)? Thus, the user of the repository will be able to switch any revision and update the environment corresponding to this particular revision.

For example, I have a repository with a project and integration server that automatically creates Docker images for each commit in the repository. How can these images be linked to the corresponding repository?

Using Docker, you have two different repositories - with the project and with Docker images - so they should be synchronized, but what are the recommended workflows for this?

+5
source share
1 answer

The Docker Hub supports two types of repositories, and you did not say what kind you use. In both cases, I suggest you put the version name w2 or the tag name in the version part of the image name, for example. Account / Repo: Version

Manual repository ( docker push )

For manual builds, you must docker tag each version with a git version. This is the recommended method because it gives you maximum control and can be automated in your build system.

Automatic build repository

For automated builds on the Docker Hub, you need to manually create a new entry for each version or tag that you want to create. This requires going to the hub web interface and creating a new build configuration for your repo, as shown in the figure below. There is currently no API, which allows you to change the build parameters on your repo, and the automatic build system does not automatically add Docker Hub tags when adding tags to the git Hub repository.

Note at this time (2014-10-07) there is an error when automatic assemblies are not actually assembled from tags in the source code repository, they are built from the head of the main branch. Status is displayed at https://status.docker.com


Here's how to add an assembly configuration to an automatic assembly:

enter image description here

+5
source

Source: https://habr.com/ru/post/1203188/


All Articles