1

I want to build a Docker image from a Dockerfile in my React App (I'm on a Windows PC using Linux container), but I get the error executor failed running [/bin/sh -c npm install --silent]: exit code: 1

My Dockerfile :

FROM node:alpine

# set working directory
WORKDIR /app

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# install app dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm install react-scripts@3.4.1 -g --silent
RUN npm install npm@9.3.1 -g --silent
RUN npm install --silent


# add app
COPY . ./

# start app
CMD ["npm", "start"]

Logs

npm notice 
npm notice New minor version of npm available! 9.2.0 -> 9.3.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.3.1>
npm notice Run `npm install -g npm@9.3.1` to update!
npm notice
The command '/bin/sh -c npm install react-scripts@3.4.1 -g --silent' returned a non-zero code: 4294967295: failed to shutdown container: container 5e7d0556df544832e3d6f1b1d0a872b229214cf124759dbc6faddbd782901fb0 encountered 
an error during hcsshim::System::waitBackground: failure in a Windows system call: Le conteneur ou la machine virtuelle avec l'identificateur spécifié n'est pas en cours d'exécution. (0xc0370110): subsequent terminate failed container 5e7d0556df544832e3d6f1b1d0a872b229214cf124759dbc6faddbd782901fb0 encountered an error during hcsshim::System::waitBackground: failure in a Windows system call: Le conteneur ou la machine virtuelle avec l'identificateur spécifié n'est pas en cours d'exécution. (0xc0370110)
VersifiXion
  • 2,152
  • 5
  • 22
  • 40
  • OK, compared to [my previous answer](https://stackoverflow.com/a/72414109/6309), you seem to be in the right folder (you can add `RUN pwd` after the command failing). Only the third `npm install` fails, right? – VonC Jan 22 '23 at 16:29
  • 1
    Can you add the logs? you can get them with `docker logs --follow `. However, can you try with `CMD ["/bin/sh", "-c", "npm start"]`? without `/bin/sh` the container can't see the env variables, so it is possible that it can't see PATH variable – mamo Jan 22 '23 at 16:31
  • Try removing `--silent` from `npm install` and run `docker build --progress plain .` to see the verbose log and find the exact error place. – Mike Mozhaev Jan 22 '23 at 16:38
  • @VonC yes only the last ```npm install``` doesn't work, I added logs at the end of my post – VersifiXion Jan 22 '23 at 16:50
  • @mamo I added logs at the end of my post thanks, and for the command you typed I get ```Error response from daemon: configured logging driver does not support reading``` – VersifiXion Jan 22 '23 at 16:50
  • Like suggested from Mike, remove `--silent`, but from `RUN npm install react-scripts@3.4.1 -g --silent` (or even better, remove all `--silent`), you should be able to see a more detailed error in the logs – mamo Jan 22 '23 at 17:40

0 Answers0