# I am trying to launch node red with docker compose and its throwing up some error

**URL:** <https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051>\
**Category:** General\
**Tags:** docker\
**Created:** [3 January 2022 17:14 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051 "2022-01-03T17:14:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dezire](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dezire/32/53495_2.png) [@dezire](https://discourse.nodered.org/u/dezire)\
**Post date:** [3 January 2022 17:14 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/1 "2022-01-03T17:14:16Z")

</div>

This is my docker compose file

```auto
version: "3"

services:
  nodered:
    container_name: nodered
    image: nodered/node-red:latest
    restart: always
    environment:
      - TZ=Asia/Kolkata
    ports:
      - "1880:1880"
    networks:
      - public
    volumes:
      - "/mnt/external/nr-personal:/data"
volumes:
  nr-personal:
networks:
  public:

```

Logs:

```auto
npm ERR! Exit status 1

 
npm ERR! Failed at the node-red-docker@2.1.4 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

> node-red-docker@2.1.4 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"

internal/fs/utils.js:332
    throw err;
    ^

Error: EACCES: permission denied, copyfile '/usr/src/node-red/node_modules/node-red/settings.js' -> '/data/settings.js'
    at Object.copyFileSync (fs.js:2061:3)
    at copyFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:70:6)
    at onFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:56:25)
    at getStats (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:48:44)
    at handleFilterAndCopy (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:33:10)
    at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:26:10)
    at Object.<anonymous> (/usr/src/node-red/node_modules/node-red/red.js:125:20)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  errno: -13,
  syscall: 'copyfile',
  code: 'EACCES',
  path: '/usr/src/node-red/node_modules/node-red/settings.js',
  dest: '/data/settings.js'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@2.1.4 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1

 
npm ERR! Failed at the node-red-docker@2.1.4 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

> node-red-docker@2.1.4 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"

internal/fs/utils.js:332
    throw err;
    ^

Error: EACCES: permission denied, copyfile '/usr/src/node-red/node_modules/node-red/settings.js' -> '/data/settings.js'
    at Object.copyFileSync (fs.js:2061:3)
    at copyFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:70:6)
    at onFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:56:25)
    at getStats (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:48:44)
    at handleFilterAndCopy (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:33:10)
    at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:26:10)
    at Object.<anonymous> (/usr/src/node-red/node_modules/node-red/red.js:125:20)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  errno: -13,
  syscall: 'copyfile',
  code: 'EACCES',
  path: '/usr/src/node-red/node_modules/node-red/settings.js',
  dest: '/data/settings.js'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@2.1.4 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1

 
npm ERR! Failed at the node-red-docker@2.1.4 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

> node-red-docker@2.1.4 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"

internal/fs/utils.js:332
    throw err;
    ^

Error: EACCES: permission denied, copyfile '/usr/src/node-red/node_modules/node-red/settings.js' -> '/data/settings.js'
    at Object.copyFileSync (fs.js:2061:3)
    at copyFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:70:6)
    at onFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:56:25)
    at getStats (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:48:44)
    at handleFilterAndCopy (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:33:10)
    at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:26:10)
    at Object.<anonymous> (/usr/src/node-red/node_modules/node-red/red.js:125:20)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  errno: -13,
  syscall: 'copyfile',
  code: 'EACCES',
  path: '/usr/src/node-red/node_modules/node-red/settings.js',
  dest: '/data/settings.js'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@2.1.4 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1

 
npm ERR! Failed at the node-red-docker@2.1.4 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

```

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [3 January 2022 17:44 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/2 "2022-01-03T17:44:55Z")

</div>

The mounted volume (on `/data`) needs to be writeable by the Node-RED user, id 1001 iirc

---

<div class="post-metadata">

**Author:** ![dezire](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dezire/32/53495_2.png) [@dezire](https://discourse.nodered.org/u/dezire)\
**Post date:** [4 January 2022 06:54 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/3 "2022-01-04T06:54:11Z")

</div>

It is able to create the mentioned directory and even the user is able to create the directory. Still the node red container is not working via this docker compose file. If I create the same container but with docker run command eveything is working fine

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [4 January 2022 07:06 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/4 "2022-01-04T07:06:43Z")

</div>

Could you try it like this:

```auto
version: "3"

services:
  nodered:
    container_name: nodered
    image: nodered/node-red:latest
    restart: always
    environment:
      - TZ=Asia/Kolkata
    ports:
      - 1880:1880
    volumes:
      - /mnt/external/nr-personal:/data

```

---

<div class="post-metadata">

**Author:** ![dezire](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dezire/32/53495_2.png) [@dezire](https://discourse.nodered.org/u/dezire)\
**Post date:** [4 January 2022 08:44 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/5 "2022-01-04T08:44:01Z")

</div>

Same problem....

---

<div class="post-metadata">

**Author:** ![dezire](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dezire/32/53495_2.png) [@dezire](https://discourse.nodered.org/u/dezire)\
**Post date:** [4 January 2022 08:46 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/6 "2022-01-04T08:46:13Z")

</div>

It is not working even if I use /home/USERNAME directory where it should typically be able to write

---

<div class="post-metadata">

**Author:** ![dezire](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dezire/32/53495_2.png) [@dezire](https://discourse.nodered.org/u/dezire)\
**Post date:** [4 January 2022 09:03 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/7 "2022-01-04T09:03:33Z")

</div>

If you don't ming pls tell me what should I do.  
I tried

```auto
sudo chown user:group /mnt/external

```

My user can create files in the directory but still nodered is not working

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [4 January 2022 09:57 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/8 "2022-01-04T09:57:21Z")

</div>

Sorry, I made a mistake earlier the node-red user inside the container is id 1000

So your volume needs to be owned by id 1000 group 10000

so `chown -R 1000:1000 /mnt/external/nr-personal`

---

<div class="post-metadata">

**Author:** ![dezire](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dezire/32/53495_2.png) [@dezire](https://discourse.nodered.org/u/dezire)\
**Post date:** [4 January 2022 11:05 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/9 "2022-01-04T11:05:16Z")

</div>

This did solve the issue but is there any way to do this in the compose file?

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [4 January 2022 11:20 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/10 "2022-01-04T11:20:01Z")

</div>

You can remap the user with the following iirc:

```auto
version: "3"

services:
  nodered:
    container_name: nodered
    image: nodered/node-red:latest
    user: "uid:gid"
    restart: always
    environment:
      - TZ=Asia/Kolkata
    ports:
      - "1880:1880"
    networks:
      - public
    volumes:
      - "/mnt/external/nr-personal:/data"
volumes:
  nr-personal:
networks:
  public:

```

where `uid` and `gid` are the numerical id's on the host system that has access to the volume.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 January 2022 10:12 UTC](https://discourse.nodered.org/t/i-am-trying-to-launch-node-red-with-docker-compose-and-its-throwing-up-some-error/56051/12 "2022-01-20T10:12:32Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
