【问题标题】:Why is the dockerfile not able to COPY?为什么 dockerfile 无法复制?
【发布时间】:2022-07-21 19:44:26
【问题描述】:

我正在使用 Docker 映像创建简单的 React 应用程序,但由于某种原因,我不断收到以下错误:

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

这是 dockerfile:

FROM /httpd:2.4.38

ENV SRVROOT=/usr/local/apache2

ENV myapp=$SRVROOT/myapp

COPY /app/build $myapp
COPY /Docker/run.sh $SRVROOT
COPY /Docker/httpd.conf $SRVROOT/conf/

RUN chmod 755 $SRVROOT/run.sh

CMD ["/usr/local/apache2/run.sh"]

【问题讨论】:

  • 你的“构建”配置在哪里?
  • 这是正确的吗? /mygapp 不是 /myapp?

标签: reactjs docker


【解决方案1】:

--from 标志用于multi-stage 构建。看起来这不是你的情况。尝试从 dockerfile 中删除 --from 标志

【讨论】:

  • 我试过但没用;/
  • 我相信如果没有--from 标志,错误应该会有所不同。你能用最新的错误更新你的问题吗?
  • 我不小心复制了旧代码,所以错误实际上是没有--from标志
猜你喜欢
  • 2017-03-09
  • 1970-01-01
  • 2015-03-08
  • 2015-08-21
  • 2022-01-10
  • 2022-01-06
  • 1970-01-01
  • 2019-02-16
  • 2016-10-18
相关资源
最近更新 更多