Setup:
Docker
[email protected]
in docker-compose.yml:
n8n:
volumes:
- ${DATA_FOLDER}/local-files:/files
Error:
I’m unable to figure out where i did wrong in this flow.
Kindly advise.
Thanks.
Setup:
Docker
[email protected]
in docker-compose.yml:
n8n:
volumes:
- ${DATA_FOLDER}/local-files:/files
Error:
I’m unable to figure out where i did wrong in this flow.
Kindly advise.
Thanks.
I think you are misunderstanding what is happening. So here a more detailed explanation:
So first, why you are actually adding those lines to the docker file. What you do there is that you say that the folder ${DATA_FOLDER}/local-files
should be made available inside of the n8n-docker-container as/files
. Both values you can change to whatever value you want.
In this case, it uses a variable and so the actual location of the folder on your host-system depends on what you have DATA_FOLDER
set to. If you have it set like in the example to /root/n8n/
the full path would be /root/n8n/local-files
. That was however just an example. You should set it to wherever you want the files to be saved to. So you could also do
n8n:
volumes:
- /home/shrey/n8n-files:/files
Now you have one folder inside of n8n that you can write to and if you do two things will happen:
So now you actually have to use that folder. Meaning in the “Write Binary File” Node under “File Name” you do not write “filename.xlsx” you write “/files/filename.xlsx”.
Then it everything will work fine.
@jan, it seems to work now, after i further modified the docker-compose.yml:
n8n:
volumes:
- ${DATA_FOLDER}/.n8n/local-files:/files
Anything i should have differently in the initial setup, for this issue to not have come up?
Glad to hear that it works now.
The only things I can think of is that you have to make sure that this folder exists (even though normally docker automatically creates it if not) and that you can write to it.
I have the same problem.
I run n8n on in docker on a synology NAS.
I mounted a folder “Share” and another folder which I used successfully for storing files from docker images for calibre…
This are the binds from the hostconfig.json of the container:
“Binds”: ["/volume1/Share:/pubshare:rw", “/volume1/docker/n8n-fileshare:/fileshare:rw”],
/volume1/Share allows write access for everyone.
I get the same error as shrey.
Error: EACCES: permission denied, open '/pubshare/file.json'
Sorry, but I have sadly no experience with synology NAS or running Docker on it. So can not be much of a help here. The only thing I know is that n8n is not doing anything special. It is using the default Node.js write functionality. So if it says that it can not write then the reason is exactly that. Meaning something on a lower level (outside of n8n) is wrong.
So if you are sure that the setup is correct then the only other thing I can think of is that the access rights of that folder are to restrictive. In this case you can simply open them up with something like: chmod 777 -R /volume1/Share
.
Hope that helps!
Thanks for your quick reply, so you say that the bind looks good. A Synology is also not much more than a Unix box with docker
I will check the permissions via ssh and see if that works.
I use synology nas and for all my other dockers you need to get the PGID and PUID to allow read and write to the host when mapping folders, this has worked for years.
I too am unable to add files to disk using binary write to disk node, however, my database and node information is all mapped to volume1/docker/n8n:/home and that works with no issues. Wonder if its a node issue.
Docker on Synology NAS
I have found the solution to this.
When mapping the Synology NAS folder it has to be in the node folder, anything outside of that will fail
e.g.
Volume1/docker/n8n/YOUR_FOLDER_HERE:/files will fail
Volume1/docker/n8n/node/YOUR_FOLDER_HERE:/files will work
it has to be in the “node” folder
Hi,
I also had an issue with Synology. And unlike /home/node/.n8n that successfully received permissions form docker, /files never could get this. I tried @RedPacketSec suggestion to add /node/ on host path, but also failed.
On the other hand, what worked for me is to add /files on docker not as root folder, but as subfolder of that very /home/node. So once I did it, I could user Write Binary files to /home/node/files and see them on host.
My thought (of a dummy unix user) is that docker only set permissions for /home/node folder, not to others if the folder is attached from host.
And we (Synology users) should be careful with permissions in File Station. If we put a file generated outside of docker, it will also have write-permission issues. This also means, that if we change the rights assigned by docker, we will loose write permissions again
Probably if we (Synology users again :)) setup Everyone permissions to these folders in File Station, docker also will be able to write data there, but I don’t want to test this because my files are generated by docker and I don’t want to tweak all scripts to create
what PGID, PUID are you using , as this will affect permission
Don’t know Tried to search yesterday how to find and change them, but failed So found another way with /files inside of /home/node
you need to add them as an [environment variable] if you are using docker (Synology: How to Find UID (userID) and GID (groupID) – Marius Hosting)
Cool! Thank you very much. Will try once get back to home where 5678 is available
But is it already available for n8n ?
So If is set my user UID|GID will it really work ?
No. I made a feature request. Upvote and hope to get implemented in the future.
if you have mapped to a folder on your NAS, you will need permissions to that folder on the NAS, by giving n8n the environment variables, this should allow n8n to write and read to and from those folders using the IDs you have given it, in effect acting as that user with the permissions.
It’s been working fine for my Synology docker install for ages by using the correct ID’s