Container Registry does not work with subgroups
Summary
Build fails when pushing a Docker image, using GitLab CI, for a subgroup's project.
This is probably due to a limitation of the way in which a docker registry is expected to work (I've never seen a host/group/subgroup/image docker registry URL, only host/group/image).
Output
invalid argument "docker-registry.example.com/group/subgroup/project:" for t: Error parsing reference: "docker-registry.example.com/group/subgroup/project:" is not a valid repository/tag: invalid reference format
Steps to reproduce
Create a project in a subgroup with a vaild Dockerfile
and .gitlab-ci.yml
:
image: docker:latest
services:
- docker:dind
.build:
stage: build
only:
- master
script:
- docker login -u "gitlab-ci-token" -p "${CI_BUILD_TOKEN}" ${CI_REGISTRY}
- docker build --pull -t "${CI_REGISTRY_IMAGE}:latest" .
- docker push "${CI_REGISTRY_IMAGE}:latest"
Potential fixes
- Modify docker-registry code to support subgroups (probably requires upstream modifications to Docker Registry and Docker clients)
- Use a valid Docker Registry path for subgroups (i.e.
group--subgroup/project
instead ofgroup/subgroup/project
). This could cause issues if there is also agroup--subgroup/project
project though.