I have a node.js application that works great inside a container but when I try to use the host as a place to store and work on the code it will no-longer update files that it needs to write.
I am trying to:
- Use my host system to put my main scripts that I edit using a GUI editor
- mount the host inside the container
- link to the scripts in the host
- launch testing.js which will run the code that has been linked
- update the text in a db .json file (a simple write file command) ✘ (not working)
I made the container privileged and did the mount:
lxc config device add c1 host disk source=/home path=/home/host readonly=false
lxc config set c1 security.privileged true
lxc restart c1
Inside the container’s /home directory:
drwxrwxrwx 13 root root 14 Jul 26 14:50 db
drwxr-xr-x 9 1001 1001 4096 Jul 31 13:52 host
lrwxrwxrwx 1 root root 28 Jul 25 16:11 private_js -> /home/host/private_js
-rwxrwxrwx root root 112 Jul 25 16:10 testing.js
inside the /home/db directory:
-rwxrwxrwx 1 root root 657 May 19 12:42 temp.json
inside /home/host/private_js mounted directory:
-rwxr-xr-x 1 root root 28107 Jul 31 15:34 driver.js
What did I do wrong, should I have used
propagation=shared when mounting??
The container is privileged but, It is as if the host is not privileged so any script that the host is hosting cannot be used to write to the json file inside the container even though the scripts are being launched from the container.