我遵循了文件结构
...
- public
- app
- docker/
- node-js/Dockerfile
docker-compose.yml
package.json
在我的dockerfile中,我有一个逻辑来复制package.json
并运行npm install
FROM node:12.0.0-alpine
MAINTAINER Bogdan Dubyk <bogdan.dubyk@gmail.comn>
COPY package.json /var/www/frontend/
RUN npm install
CMD [ "npm", "start" ]
但是在构建映像时出现错误ERROR: Service 'node-js' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder184577258/package.json: no such file or directory
,看起来像Dockerfile只是在自己的文件夹中查找文件?是否可以从文件夹外部复制文件?
我尝试了COPY ../../package.json /var/www/frontend/
,但也遇到了错误ERROR: Service 'node-js' failed to build: COPY failed: Forbidden path outside the build context: ../../package.json ()