# Docker - Node Red - add and access additional volume

**URL:** <https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724>\
**Category:** General\
**Tags:** docker\
**Created:** [16 June 2024 02:45 UTC](https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724 "2024-06-16T02:45:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulf007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulf007/32/26758_2.png) [@Paulf007](https://discourse.nodered.org/u/Paulf007)\
**Post date:** [16 June 2024 02:45 UTC](https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724/1 "2024-06-16T02:45:53Z")

</div>

Good morning all.  
I am running node-red in docker and want to share a text file outside of docker.  
In the docker compose file I did

> volumes:  
> - ./node\_red\_data:/data  
> - /home/server/docker/shared:/sharedfolder

I then placed a mytext.txt in the "/home/server/docker/shared" folder.

My assumption was/is that I would then be able to access the "/sharedfolder' within node red but when I try to write data to a text file I get the following error

`"failed to append to file: Error: ENOENT: no such file or directory, open '/sharedfolder/mytext.txt'"`

Writing to data to a /data/test.txt file works without a problem.  
Am I accessing the folder/file incorrectly?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 June 2024 06:27 UTC](https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724/2 "2024-06-16T06:27:05Z")

</div>

The error suggests you are trying to add to an existing file. Does it already exist?

**[Edit]** Oh I see you have said that you have put a file there. Are you sure you have named it correctly, I see you have said

> [@Paulf007](#):
>
> Writing to data to a /data/test.txt file works without a problem.

which is test.txt not mytext.txt.

Otherwise I don't know. I prefer to avoid docker whenever practical.

---

<div class="post-metadata">

**Author:** ![questuk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/questuk/32/4059_2.png) [@questuk](https://discourse.nodered.org/u/questuk)\
**Post date:** [16 June 2024 09:58 UTC](https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724/3 "2024-06-16T09:58:23Z")

</div>

Hi [Paulf007](https://discourse.nodered.org/u/Paulf007),

I access my files on my host PC using Bind mounts, that should solve your problem ?

> **[Manage data in Docker](https://docs.docker.com/storage/)**
>
> Overview of persisting data in containers

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [16 June 2024 23:43 UTC](https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724/4 "2024-06-16T23:43:10Z")

</div>

Hello Paul,

I had the same issue with access or create files/folders on my NAS drive .. I made a small write-up on how to bind your NAS Shared-Drives to docker [here](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/9)

I hope it helps

---

<div class="post-metadata">

**Author:** ![Paulf007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulf007/32/26758_2.png) [@Paulf007](https://discourse.nodered.org/u/Paulf007)\
**Post date:** [19 June 2024 01:32 UTC](https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724/5 "2024-06-19T01:32:47Z")

</div>

Good morning all.

Thank you for all the feedback , I did some further reading as suggested and the solution seems to be that you need to "link" the folders within the /data/ folder so your docker compose should look like this.

```auto
volumes:
- ./node_red_data:/data
- /home/server/docker/shared:/data/sharedfolder

```

Then before you deploy the container create the folder 'sharedfolder' within the "node\_red\_data".  
So you will have "/node\_red\_data/sharedfolder" on the real world.  
I sort off expected for docker compose to do this but I am in no way an expert here and are just fiddling until I get it right 😉  
I have tested this, and it works. If you create a file in NR the file will be created in the " /home/server/docker/shared" directory , the "/node\_red\_data/sharedfolder" folder will remain empty.  
Hope this will help someone later.

---

<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:** [3 July 2024 01:33 UTC](https://discourse.nodered.org/t/docker-node-red-add-and-access-additional-volume/88724/6 "2024-07-03T01:33:48Z")

</div>

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