I have an angular app which I dockerized together with nginx. My 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"]
I build my docker image but when I start docker run I get following error message:
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.
If I remove the last command from my Dockerfile (CMD ["npm","start"] I can run my docker image - it works. But I guess I need the last command so I can deploy and run my app in AWS. Also 'CMD npm start' doesnt work.
I have seen a couple of post about similar issues but non of the solutions worked for me.
UPDATE:
I removed the last line - CMD npm start. ECS is now trying to start my task - but it stops with exit code 1 and no further comments. Any idea?
Thanks, Michael
The nginx
docker image doesn't contain npm
. You'll need to use node:latest
or node:alpine
which contains npm
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With