Kane Hooper
Kane Hooper

Reputation: 1919

Dockerfile.dev: nodemon: Permission denied

Setting up my dev environment on Docker. I am running Nodejs v16.16.0.

I am using Nodemon and a docker volume to keep my dev work in sync with the docker container.

Dockerfile.dev

FROM node:alpine

WORKDIR /usr/src/app

COPY . .

RUN npm install

EXPOSE 3000

CMD ["npm", "run", "dev"]

package.json

{
  "name": "docker-example-1",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index",
    "dev": "nodemon index",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Kane Hooper <kanehooper@hotmail.com>",
  "license": "MIT",
  "dependencies": {
    "express": "^4.18.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.19"
  }
}

I execute docker run -p 8080:3000 -v $(pwd):/usr/src/app -v /usr/src/app/node_modules --name nodeappcontainer nodeapp

I get the following error /tmp/dev6585779965.sh: line 2: nodemon: Permission denied

Any assistance on how to resolve this would be much appreciated.

Upvotes: 2

Views: 458

Answers (1)

Kane Hooper
Kane Hooper

Reputation: 1919

The problem resolved when I bumped the version of nodemon from 2.0.18 down to 2.0.16.

I've raised an issue on the nodemon github repo.

Upvotes: 1

Related Questions