Closed vorburger closed 1 year ago
@jamesread
I would be surprised if this changed recently, I'll need to check this one. It seems strange to use "/home" directly, as well.
This was intriguing! 😈 You ARE right, of course, that the HOME of the Fedora container hasn't changed:
$ podman run -it fedora:latest bash -c 'echo $HOME'
/root
Your container (latest version published right now) also clearly uses /root/
, see:
$ podman run -it jamesread/prometheus-gmail-exporter:latest
CRITICAL:root:Client secrets file does not exist: /root/.prometheus-gmail-exporter/client_secret.json . You probably need to download this from the Google API console.
Even if I locally build it it's the same:
$ podman build . -t gmail-exporter
$ podman run -it gmail-exporter
CRITICAL:root:Client secrets file does not exist: /root/.prometheus-gmail-exporter/client_secret.json . You probably need to download this from the Google API console.
However, something somewhere changes the home directory of this container for me where I run it... I' really not sure, looks like a Google Cloud Run or gVizor or WHATEVER weirdness, check out this log, and note /home
instead of /root/
, just FYI and to "prove" why I had originally raised this:
"CRITICAL:root:Client secrets file does not exist: /home/.prometheus-gmail-exporter/client_secret.json . You probably need to download this from the Google API console."
But whatever this is, it probably doesn't belong into this project / git repo, so let me close this PR.
@vorburger , ah, I think I probably know why. It's probably that Google Cloud Run tries to start the container as USER 1001 or something, so the container doesn't need root privileges. To be honest that would be the cleaner/better thing to do - I just built a quick and dirty dockerfile some time ago.
A simple sanity check would be to log the $UID and $HOME on startup.
Because that's where $HOME is in
FROM fedora:latest
- at least in current v37; perhaps this changed at some point in the past.PS: I've also flipped around the
-v
and the container name just so it's consistent and easier to read among both of your examples.