我新建了一个dockerfile内容如下
FROM node:latest
RUN mkdir -p /mnt/app
# Create app directory
WORKDIR /mnt/app
# Install app dependencies
COPY package.json /mnt/app
RUN npm install
# Bundle app source
COPY . /mnt/app
EXPOSE 3000
CMD [ "npm", "start" ]
docker-compose文件内容如下
node:
build:
context: ./services/node/website
dockerfile: Dockerfile
ports:
- "3000:3000"
#volumes:
# - ./app:/mnt/app
文件结构是
问题现在是不使用docker-compose数据映射,单纯使用dockerfile copy方法进去就可以跑起来node,但如果我使用数据映射
volumes:
- ./app:/mnt/app
则就报错
报错信息如下:
npm info it worked if it ends with ok
npm info using npm@5.4.2
npm info using node@v8.7.0
npm ERR! path /mnt/app/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/mnt/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-10-20T03_08_13_487Z-debug.log
求大神看下