构建 Docker 镜像时出现以下错误:

huangapple go评论43阅读模式
英文:

While building docker images getting below error

问题

警告:buildx:无法获取 git 提交记录:致命错误:模糊参数 'HEAD':工作树中不存在未知修订版或路径。

请使用 '--' 将路径与修订版分开,就像这样:

'git <命令> [<修订版>...] -- [<文件>...]'

尝试构建镜像,但出现上述错误,因为与 git 没有关联,所以我为什么会遇到与 git 相关的问题,因为我正在从 Dockerfile 创建 Docker 镜像。

英文:

WARNING: buildx: failed to get git commit: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git <command> [<revision>...] -- [<file>...]'

tried to build image but getting above error
because there is no relationship with git why I'm getting git related issues becuase I am creating docker image from Dockerfile

答案1

得分: 1

我在一个新的 Git 存储库中运行 docker build . 时遇到了相同的错误。
提交第一个提交应该会移除这个错误信息。

英文:

I got the same error when I ran docker build . inside a new Git repository without any commits.

Committing the first commit should remove the error message.

huangapple
  • 本文由 发表于 2023年2月20日 00:14:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75501536.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定