0

I am using docker swarm to control a deployment with several containers used for a machine learning application.

I have a bash script which sends commands to be executed by some containers. When I do execute this script manually in the console, everything works fine, the commands are sent to the containers and run BUT when I added this same script to be executed by the cron, it doesn't work (I am using the crontab -e command so the script be executed with my user)

Here's one example of scripts we need to run:

eval $(docker-machine env --swarm director)
docker exec -d container_luigi-worker_1 luigi  --module etl AllTasks

And the cron line is: 16 * * * * sh /path/script.sh

As we are using swarm, first we need to get into the env of the director, then we execute the command using docker exec (in this case is a command to start a job using spotify's luigi tool)

What am I missing? thanks

Karlovalentin
  • 321
  • 1
  • 3
  • 14
  • Are you sure that `cron` is in the entrypoint of the container? – Auzias Aug 24 '16 at 07:14
  • 1
    Not clear where your running the cron task. On your host machine or within the containers? The latter is unlikely to work unless you've configured a service manager within your containers (Docker normally runs a single process). Secondly you're using the older swarm, worthwhile to check our the new swarm mode that is now built into docker 1.7 – Mark O'Connor Aug 24 '16 at 07:15
  • I am trying to run the cron in my host machine, as i mentioned before, it runs with no trouble when i manually run it from the console, it's just on the cron which doesn't do anything. – Karlovalentin Aug 24 '16 at 20:53

0 Answers0