Docker build failed: tag invalid reference format (Gitlab CI)

淺唱寂寞╮ 提交于 2020-08-09 10:00:47

问题


I've created a repo in gitlab for a Dockerfile. In the .gitlab-ci.yml i defined two stages: build and push to the registry.

This is the .gitlab-ci.yml file:

image: docker

stages:
    - build
    - push

build:
    stage: build
    script:
      - docker build --no-cache -t ${DOCKER_REGISTRY}/debian9-cunit .

push:
    stage: push
    script:
      - docker push ${DOCKER_REGISTRY}/debian9-cunit

When I run the pipeline, the build stage fails saying:

invalid argument "/debian9-cunit" for "-t, --tag" flag: invalid reference format

The same exact code (with only a different name after "/debian9-") works with no problem in another repo of a collegue. What can be the problem?


回答1:


If anyone is having this issue in combination with Heroku-based applications (e.g. in Gitlab AutoDevOps) you might need to activate the GitLab container registry on your GitLab installation and in your project.




回答2:


Problem solved: I didn't have a GitLab runner on my personal company profile. The other project was of a group that has a shared runner.



来源:https://stackoverflow.com/questions/53172658/docker-build-failed-tag-invalid-reference-format-gitlab-ci

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!