当docker运行时(npm ERR!path /package.json)
这是我的Dockerfile
FROM node:8
WORKDIR /app
ENV NODE_ENV development
EXPOSE 3000
CMD ["npm", "start"]
app Dockerfile env.sh export-doc.sh mongo README.md redis
/应用 图片日志node_modules package.json package-lock.json src tsconfig.json
当我运行docker ...
docker run -p 3000-名称服务器server:0.1。 //我想要127.0.0.1/3000
发生错误(npm ERR!路径/package.json)
我如何修改Dockerfile?
答案 0 :(得分:0)
如此处的说明https://nodejs.org/de/docs/guides/nodejs-docker-webapp/ 尝试这样的事情:
FROM node:8
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "npm", "start" ]