Docker 基于 github 分支找不到指定的文件

Docker build on github branch cannot find file specified

我正在尝试使用以下命令在 Windows 10 上构建 Docker 映像:

docker build -t cron_runner .

但是我收到以下错误:

unable to prepare context: unable to evaluate symlinks in context path: readlink C:\Users\xxx\Tools\Internal_Tools: The system cannot find the file specified.

文件夹中有一个没有扩展名的标准 Docker 文件。但是,该文件夹位于 git 不是主分支的分支上。

如果我将 Docker 文件从 Git 文件夹移到本地文件夹中,docker 图像构建没有任何问题,所以我认为问题与事实有关它在一个分支上,因此存在符号链接问题。

当你 运行 docker build; docker 复制您的 上下文 ;这是您的 Dockerfile 所在的整个目录(使用 .dockerignore 时除外)。

您的 Dockerfile 所在的目录中似乎有一个(损坏的?)符号链接;所以要么清理父目录;将 Dockerfile 移动到一个干净的子目录中。