git - GitHub Build容器镜像出现错误

标签 git docker github github-actions

我通过遵循GitHub Actions: Publish to GitHub Packages培训来学习CD。
所以我创建了一个Dockerfile,但是无法构建。我不明白为什么会发生此错误。你怎么解决呢?
到目前为止,我仅使用该机器人提供的源代码,因此很难想到一个简单的错字。
https://github.com/CreatorOfWhileStudying/github-actions-for-packages/pull/3
这是错误消息的摘录。

Logging in to registry docker.pkg.github.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /github/home/.docker/config.json.
Configure a credential helper to remove this warning. See
Login Succeeded
Building image [docker.pkg.github.com/CreatorOfWhileStudying/github-actions-for-packages/tic-tac-toe:sha-05b1cf1]
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

invalid argument "docker.pkg.github.com/CreatorOfWhileStudying/github-actions-for-packages/tic-tac-toe:sha-05b1cf1" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
See 'docker build --help'.
Error: exit status 125

最佳答案

您的 .github/workflows/cd-workflow.yml 提到:

    - name: Build container image
      uses: docker/build-push-action@v1
      with:
        username: ${{github.actor}}
        password: ${{secrets.GITHUB_TOKEN}}
        registry: docker.pkg.github.com
        repository: CreatorOfWhileStudying/github-actions-for-packages/tic-tac-toe
        tag_with_sha: true
仓库部分与docker构建不兼容,如logs for that action所示:
2020-09-17T06:09:53.7368087Z Building image [docker.pkg.github.com/CreatorOfWhileStudying/github-actions-for-packages/tic-tac-toe:sha-05b1cf1]
2020-09-17T06:09:53.7369825Z https://docs.docker.com/engine/reference/commandline/login/#credentials-store
2020-09-17T06:09:53.7370487Z 
2020-09-17T06:09:53.7551260Z invalid argument "docker.pkg.github.com/CreatorOfWhileStudying/github-actions-for-packages/tic-tac-toe:sha-05b1cf1" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
2020-09-17T06:09:53.7552333Z See 'docker build --help'.
2020-09-17T06:09:53.7573573Z Error: exit status 125
该错误来自GitHub Action docker/build-push-action ,就像issue 37一样。
尝试使用docker/build-push-action@v2

关于git - GitHub Build容器镜像出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63932268/

相关文章:

git config core.autocrlf 是 true,但我仍然收到警告?

linux - 如何运行 dockerfile?

django - django开发服务器运行时,如何 curl 127.0.0.1/8000?

Jenkins GitHub 拉取请求构建器 - 获取执行 shell 的分支名称

git - *在*提交之前更改一个特定提交的名称、电子邮件和/或日期

git - 两个相同的 git 存储库

ios - 天真的 Git 设置,是否可以取消跟踪我的 .gitignore 中列出的文件?

c# - 我应该安装哪些库才能在基于Alpine的图像中的ASP NET Core应用程序中使用System.Drawing.Common

linux - 使用软件 bam-window 软件的 cmake 错误

php - 为什么 Composer 安装突然失败?