As you can see, the Docker template is configured by default to use the GitLab container registry.
...
...
@@ -77,9 +77,24 @@ You may perfectly override this and use another Docker registry, but be aware of
* the `DOCKER_SNAPSHOT_IMAGE` requires a Docker registry that allows tag overwrite,
* the `DOCKER_RELEASE_IMAGE` _may_ use a Docker registry that doesn't allow tag overwrite, but:
1. you should avoid overwriting a Git tag (at it will obviously fail while trying to (re)push the Docker image),
1. you should avoid overwriting a Git tag (as it will obviously fail while trying to (re)push the Docker image),
2. you have to deactivate publish on `master` branch by setting the `$PUBLISH_ON_PROD` variable to `false` (as it would lead to the `master` tag being overwritten).
#### Which tag to use?
By default, the Docker template uses `$CI_COMMIT_REF_NAME` as image tags.
It has advantages (the tag is meaningful to you, especially when releasing via a Git tag) and drawbacks (compels using a Docker registry that allows tag overwrite; when continuously deploying the image, it may be tough to force redeploying the container when the image
name didn't change).
Depending on your context, you may prefer using another tagging policy.
For instance `$CI_COMMIT_TIMESTAMP` might be a good alternative.
Whichever your choice, the Docker template normalizes the tag value so that it complies to the [standard syntax](https://docs.docker.com/engine/reference/commandline/tag/#extended-description):
> A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.
The Docker template simply replaces any forbidden character with a dash (`-`).
### Registries and credentials
As seen in the previous chapter, the Docker template uses by default the GitLab registry to push snapshot and release images.