I have a script that checks every minute if docker desktop is running. If it fails, it should launch docker desktop.
My script works fine if I run from command line, but it fails when I run it by cronjob. Any ideas how to fix this? Ive tried everything.
This is the error:
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)
com.docker.backend is not running. Starting Docker Desktop...
Error starting Docker Desktop: Command '['systemctl', '--user', 'start', 'docker-desktop']' returned non-zero exit status 1.