I did:
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
So why isn’t docker running when my cron script runs?
$ cat /etc/group
...
admin:x:1000:
docker:x:997:admin
...
$ crontab -l -u admin
...
40 14 * * * /home/admin/dockerTest.sh
$ cat dockerTest.sh
echo $(date) >>out.txt
docker run hello-world >>/home/admin/out.txt 2>&1
$ cat out.txt
Wed Jul 17 14:40:01 EDT 2024
docker: Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
If I run dockerTest.sh
while I’m signed in, or even cron runs it while I’m signed in, it works (because the daemon is running). So I think I just need to keep docker running somehow. Should I just run some throwaway container or something to keep docker loaded? What am I doing wrong?