I am getting an error mounting a config file, can anyone assist?
With subPath on volumeMounts I get the error: Error: stat /var/config/openhim-console.json: no such file or directory.
I can read this file.
Without subPath on volumeMounts I get this error:
Error: failed to start container “openhim-console”:
Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused “process_linux.go:339: container init caused “rootfs_linux.go:57: mounting \”/var/config/openhim-console.json\” to rootfs \"/var/lib/docker/overlay2/7408e2aa7e93b3c42ca4c2320681f61ae4bd4b02208364eee8da5f51d587ed21/merged\" at \"/var/lib/docker/overlay2/7408e2aa7e93b3c42ca4c2320681f61ae4bd4b02208364eee8da5f51d587ed21/merged/usr/share/nginx/html/config/default.json\" caused \“not a directory\”""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Warning BackOff 2s kubelet, ip-10-0-65-230.eu-central-1.compute.internal Back-off restarting failed container
I think the important part of the error is this one:
caused \“not a directory\”""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
I have another very strange thing with this topic. I am able for this to work 100% using Minikube and Virtualbox to a shared volume but I am having an impossible time on Linux.
Do you know if there are any special permissions needed for the files to be visible? I have run this on the directory I use /var/config/openhim-console
sudo chmod -R a+rwx /var/config but still I am unable to see these files from the container?
It is bizzare to be honest. So the exact same json config file runs on minikube but here is what I get on the Linux instance. This is AWS Linux Bastion server.
chmod a+rw /var/config -R
Error: Error parsing your configuration file: [/usr/src/app/config/development.json]: **EISDIR: illegal operation on a directory, read**
at exports.File.File.loadSync (/usr/src/app/node_modules/nconf/lib/nconf/stores/file.js:170:11)
at exports.Provider.Provider.add (/usr/src/app/node_modules/nconf/lib/nconf/provider.js:136:23)
at exports.Provider.Provider.file (/usr/src/app/node_modules/nconf/lib/nconf/provider.js:63:15)
at new Config (/usr/src/app/lib/config/config.js:55:21)
at Object.<anonymous> (/usr/src/app/lib/config/config.js:72:33)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/src/app/lib/config/index.js:7:15)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
if I use chmod 777 /var/config -R
Error: Error parsing your configuration file: [/usr/src/app/config/development.json]: **Unexpected end of JSON input**
at exports.File.File.loadSync (/usr/src/app/node_modules/nconf/lib/nconf/stores/file.js:170:11)
at exports.Provider.Provider.add (/usr/src/app/node_modules/nconf/lib/nconf/provider.js:136:23)
at exports.Provider.Provider.file (/usr/src/app/node_modules/nconf/lib/nconf/provider.js:63:15)
at new Config (/usr/src/app/lib/config/config.js:55:21)
at Object.<anonymous> (/usr/src/app/lib/config/config.js:72:33)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/src/app/lib/config/index.js:7:15)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
Is it possible that a module like nconf are unable to read the file due to permissions?