I have the problem than when I start my service a environment variable I have set in the service file is not set. The Service file is as follows
[Unit]
Description=<DESCRPITON>
After=podman.socket
Requires=podman.socket
[Service]
Environment=DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
TimeoutStartSec=0
ExecStart=/usr/bin/<BINARY_NAME>
Restart=always
Type=notify
NotifyAccess=all
User=<USER>
[Install]
WantedBy=multi-user.target
If I set the environment variable with systemctl --user set-environment DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
then it works. But not when the system is reboot as for some reason the information is lost.
I have to run the service under as the user and under the user, so it is run with systemctl enable --now serivce-name.service
.
I have looked at How to set environment variable in systemd service? but could not find a solution from here. I was thinking about adding an configuraiton file, it just seems a little to much for a single Env variable.
This is running on Fedora and RedHat (8.8) if it is relevant.