Docker CLI commands to export credentials and workflows error

Thank you!
I gave up after spending 2 hours on trying to figure out the backup.
The key thing missing was which user - ie -u node
I had tried other users in /etc/passwd

I am getting a permission error on export.
I set the n8n-export to chmod 777

probably something with the docker volume and having to mount it locally first outside the container? I couldnt figure it out. I tried to attach a container but failed

docker exec -u node -it 9ce3c04815a3 n8n export:workflow --backup --output=/root/n8n-exports

Aborting execution as a filesystem error has been encountered while creating the output directory. See log messages for details.

FILESYSTEM ERROR
====================================
EACCES: permission denied, mkdir '/root/n8n-exports'
Error: EACCES: permission denied, mkdir '/root/n8n-exports'
    at Object.mkdirSync (node:fs:1382:3)
    at ExportWorkflowsCommand.run (/usr/local/lib/node_modules/n8n/dist/commands/export/workflow.js:64:34)
    at ExportWorkflowsCommand._run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/command.js:43:31)
    at Config.runCommand (/usr/local/lib/node_modules/n8n/node_modules/@oclif/config/lib/config.js:173:24)
    at Main.run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/main.js:28:9)
    at Main._run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/command.js:43:20)
Error exporting workflows. See log messages for details.
EEXIT: 1

this line works but only exports me a default workflow I guess since it mounts a new empty container?

docker run -it --rm -v ~/n8n-exports:/data-export -v ~/.n8n:/home/node/.n8n n8nio/n8n n8n export:workflow --backup --output=/data-export`


Hey @thomastraum,

It looks like a permission issue, The command is running as the node user with the -u node flag but you have the output set to /root/n8n-exports which the node user won’t have permission to access.

Try using a output folder of /home/node/n8n-exports and see if that works.

thanks so much that worked!! @Jon