无法使用前端 dockerfile 解决 [英] failed to solve with frontend dockerfile

查看:48
本文介绍了无法使用前端 dockerfile 解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Docker 很陌生,并尝试使用纯 html 构建 docker 映像,但我收到此错误消息,说使用前端 dockerfile.v0 无法解决:无法读取 dockerfile:打开/var/lib/docker/tmp/buildkit-mount602954594/Dockerfile:没有这样的文件或目录

I am pretty new to Docker and trying to build docker image with plain html but i have this error message, saying failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount602954594/Dockerfile: no such file or directory

我的文件夹目录是这样的

My folder directory is like this

C:UsershaileyDesktopGitTest
                               |- Dockerfile.txt
                               |- README.md
                               |- testHelloWorld.html

在 Dockerfile 里面,我有

Inside of the Dockerfile, I have

FROM ubuntu  
WORKDIR C/Users/hailey/Desktop/GitTest
COPY testHelloWorld.html .
EXPOSE 8080
CMD ["html","testHelloWorld.html"]

我执行了命令 docker build .在目录 C:UsershaileyDesktopGitTest 中.然后得到了

I did my command docker build . inside of the directory C:UsershaileyDesktopGitTest. then got

[+] Building 0.1s (2/2) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                           
 => => transferring dockerfile: 2B                                                                                                                                             
 => [internal] load .dockerignore                                                                                                                                              
 => => transferring context: 2B                                                                                                                                               
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount602954594/Dockerfile: no such file or directory

还有谁知道我做错了什么吗?

Does anyone have any other what I did wrong?

推荐答案

docker文件名没有扩展名,就是Dockerfile加大写D小写f

The name of docker files has no extension, it's just Dockerfile with capital D and lowercase f

您还可以指定 Dockerfile 名称,例如 docker build .-f Dockerfile.txt 如果你想给它起别的名字

You can also specify the Dockerfile name such as docker build . -f Dockerfile.txt if you'd like to name it something else

这篇关于无法使用前端 dockerfile 解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆