Dockerfile 构建错误 : The system cannot find the path specified

标签 docker dockerfile

C:\kafka> docker build Dockerfile
[+] Building 0.0s (1/2)
 => ERROR [internal] load build definition from Dockerfile                                                                                               0.0s
 => => transferring dockerfile: 63B                                                                                                                      0.0s
------
 > [internal] load build definition from Dockerfile:
------
failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: walk Dockerfile: The system cannot find the path specified.

以上是我遇到的错误和命令运行的示例。
我的 Dockerfile 被命名为“Dockerfile”,因为我已经阅读了许多答案,但仍然没有解决。
我的 Dockerfile 也在我所在的目录中。

最佳答案

要构建 docker 镜像:

cd /path/where/docker_file/lives
docker build .
上面是一样的:
docker build -f Dockerfile .
您需要指定 Dockerfile仅当它不是默认值时才命名:
cd /path/where/docker_file/lives
docker build -f Dockerfile.modified .

关于Dockerfile 构建错误 : The system cannot find the path specified,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65794617/

相关文章:

MYSQL Docker 容器给出 "unknown database"错误

node.js - 为什么容器 IP 和别名之间的交换会导致 AJAX 请求出现差异?

amazon-web-services - 对数据库使用RDS还是容器(ECS)?的优点和缺点

docker - 从Dockerfile构建时,Docker标记标志不起作用

Docker build 如何在golang build中添加库

postgresql - 将 docker 服务连接到 docker 数据库容器时出现 Postgres ENOTFOUND 错误

postgresql - 使用 postgres 配置 dockerfile

docker - 使用 sysctl 更改 docker 文件中的内核参数,运行的容器是否会影响主机内核

docker - 如何在没有 visual studio 且没有 docker compose 的情况下使用 docker 复制 csproj 文件?

docker - 容器构建错误 - 无法关闭容器 - 容器在关闭期间遇到错误