aiguofer
aiguofer

Reputation: 2135

Cron job can't connect to Docker daemon

I made a docker image to run some processes in a server without sudo access but with my user in the docker group.

When I run the process from the shell, everything works fine. However, when I try to run it with cron, it fails with:

docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See '/usr/bin/docker-current run --help'.

Here's more or less what I'm running (it's actually a bit more complex that this, but it still fails when I simplify to this).

docker run --rm --privileged -i my_img python -m adhoc.test

My crontab then looks like this:

* * * * * docker run --rm --privileged -i my_img python -m adhoc.test

It had been working fine for a while, but it suddenly stopped working today. The only change I made was rebuilding the image, any thoughts on what might be going on or where to start looking?

Upvotes: 0

Views: 387

Answers (1)

aiguofer
aiguofer

Reputation: 2135

I considered deleting this, but who knows, someone might benefit from it in the future.

It turns out that a mass user update had removed me from the docker group. While the logged in shell still had that group permission, the cron job did not.

Upvotes: 1

Related Questions