I recently had a problem when I want to execute the docker-compose command in crontab.
I have a YAML file containing dockers that define all the services I need, for example "docker-compose.yml". And I also have a Makefile in which I wrote some command to do something.
My makefile:
.PHONY operate
operate:
/usr/local/bin/docker-compose -p /project -f ~/docker-compose-production.yml run rails env
This make script worked fine when it was executed in the shell. He listed the entire var I environment defined in the docker-compose.yml file. But when I put it in crontab. The result became strange: there is nothing in it, but only $PATH.
My crontab file:
57 21 * * * make -f ~/Makefile operate >~/temp 2>&1
I suppose there should be some kind of var environment that docker-compose should have, but I don't know. Do you have an idea about this problem?