Dockerfile Stat var/www/html:不存在文件

发布于 2025-02-12 15:01:00 字数 510 浏览 0 评论 0原文

今天,我尝试使用Dockerfile指令来创建新图像。 我的dockerfile

FROM 1275178869/base_image_apache_php_mysql:sjx 

COPY file /var/www/html     

RUN rm /var/www/html/index.html

EXPOSE 80

运行命令

docker build -t sql:sql .

然后在步骤2中 副本失败了:

COPY failed: file not found in build context or excluded by .dockerignore: stat var/www/html: file does not exist

这意味着我使用的镜像源 ··· 来自1275178869/base_image_apache_php_mysql:sjx ··· 没有路径/var/www/html

Today i trying to ues the Dockerfile instructions to create a new image.
my dockerfile

FROM 1275178869/base_image_apache_php_mysql:sjx 

COPY file /var/www/html     

RUN rm /var/www/html/index.html

EXPOSE 80

Then I run the command

docker build -t sql:sql .

in step 2
copy failed like:

COPY failed: file not found in build context or excluded by .dockerignore: stat var/www/html: file does not exist

is that mean the mirror source i use
···
FROM 1275178869/base_image_apache_php_mysql:sjx
···
There is no path /var/www/html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖伴 2025-02-19 15:01:00

让您给您一些可能的解决

方案使用./以及与文件扩展名一起

COPY ./file.txt /destination/path

使用的情况,如果是目录,请使用add

add ./file/dettlain/dattilles/path

也确保不具有 file 在您的.dockerignore中

Let give you some possible solutions

Use COPY with ./ and also with the file extension

COPY ./file.txt /destination/path

In the case if it is a directory, use ADD

ADD ./file /destination/path

Also make sure not to have file in your .dockerignore

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文