简体   繁体   中英

Nodemon on Docker container gets “Permission denied”

I have a Node.js server inside a Docker container that uses Nodemon. On my Windows 10 machine everything is working perfectly, however when I try to install it with docker-compose on Ubuntu I get the following error:

/usr/local/bin/docker-entrypoint.sh: exec: line 8: /usr/src/app/node_modules/.bin/nodemon: Permission denied

I have found out that Nodemon sometimes does this and a solution would be to install it globally using sudo. I have done that and I've also tried running an npm install of Nodemon before copying package.json in the Dockerfile but it didn't work. Also, there doesn't seem to be any docker-entrypoint.sh at that location.

Here is my Dockerfile:

FROM node:10.16-alpine

RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app
COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 8080

CMD ["npm","start"]

You are missing executable permissions on the binary. You could add the following torwards the end of your Dockerfile:

chmod +x /usr/src/app/node_modules/.bin/nodemon

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM