Answer the question
In order to leave comments, you need to log in
Why docker image doesn't see ng command?
When trying to run the docker image, the following error occurs:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"ng\": executable file not found in $PATH": unknown.
# base image
FROM node:9.6.1
# set working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /usr/src/app/package.json
RUN npm install
RUN npm install -g @angular/cli
# add app
COPY . /usr/src/app
EXPOSE 4200
# start app
CMD ng serve --prod
Answer the question
In order to leave comments, you need to log in
Docker had an image already built earlier, which contained an error - angular was not installed there and the ng command did not work either. To solve the problem, it was necessary to remove the image (and, accordingly, the containers that contained it), and then build a new image with the current Dockerfile
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question