我是 docker 新手,我试图通过构建 Dockerfile 将 index.html 从 Docker 主机复制到容器的 Nginx 路径,但在执行 COPY 命令时出现以下错误
Step 2/2 : COPY /root/static/flexed/index.html /usr/share/nginx/html/
COPY failed: file not found in build context or excluded by .dockerignore: stat root/static/flexed/index.html: file does not exist
以下是Dockerfile的详细信息
FROM nginx
COPY /root/static/flexed/index.html /usr/share/nginx/html/
我已经检查了我的源路径和路径中存在的文件
ls /root/static/flexed/
css images index.html js
有人能帮我吗?我一直被困在这个问题上。很少有文章建议检查 .dockerignore 文件是否存在此错误。试图检查但没有找到任何可行的解决方案。