Mic*_* H. 6 nginx docker angular
我有一个我与nginx一起docker化的角度应用程序。我的dockerfile:
FROM node:8.11.3 as node
WORKDIR /app
COPY package.json /app/
RUN npm install
COPY ./ /app/
ARG env=prod
RUN npm run build -- --prod --environment $env
FROM nginx:1.13
COPY --from=node /app/dist/ /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf
EXPOSE 4200
CMD ["npm", "start"]
Run Code Online (Sandbox Code Playgroud)
我构建了Docker映像,但是当我启动docker run时,出现以下错误消息:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"npm\": executable file not found in $PATH": unknown.
Run Code Online (Sandbox Code Playgroud)
如果我从Dockerfile(CMD [“ npm”,“ start”]中删除最后一个命令,则可以运行我的docker映像-它可以工作。但是我想我需要最后一个命令,以便可以在AWS中部署和运行我的应用程序。 “ CMD npm start”不起作用。
我看过几篇有关类似问题的文章,但没有一种解决方案对我有用。
更新:
我删除了最后一行-CMD npm start。ECS现在正在尝试启动我的任务-但它以退出代码1停止并且没有更多注释。任何的想法?
谢谢迈克尔