I have a cron job which dumps my influx database nightly before borg does a backup of it. It does that by running
influx backup in the container with the command:
docker exec influx /usr/local/bin/influx backup /backups
Sometimes it works, and sometimes it gives the error OCI runtime exec failed: open /run/user/0/runc-process3412184934: no such file or directory: unknown.
It turns out this is because
/run/user/0 doesn't exist unless root is logged in which is why sometimes it worked and other times it didn't depending on if I had a root shell open somewhere (like when I was testing the script). I use elogind and couldn't find any option to not delete the runtime directory, I guess systemd logind should be the same. I also tried setting
XDG_RUNTIME_DIR but docker ignores that.
In the end I just got my script to check if /run/user/0 existed with:
if [ ! -d /run/user/0 ]; then echo "Missing /run/user/0, creating it" mkdir -v /run/user/0 fi
It might also work if I make sure that docker is run in a login shell and then elogind should handle the creation of the runtime directory for me.