Reputation: 13106
I have a virtual machine running Ubuntu 16.04 that I want to run cron-scheduled Docker containers on. I have configured the Docker host and my image repository such that they are accessible by the VM, and images run fine on the machine.
My issue is that when I create a cron-schedule using crontab -e in /var/spool/cron
, the containers do not show up. I should be able to view any stopped containers using $ docker ps -a
, but it does not show them. Running sudo grep CRON -i /var/log/syslog
shows the output:
Mar 20 16:22:01 SpacyVM CRON[121879]: (bdsadmin) CMD (docker run -d
bdsdev.azurecr.io/crawler-public)
Mar 20 16:22:05 SpacyVM CRON[121878]: (CRON) info (No MTA installed,
discarding output)
Mar 20 16:24:01 SpacyVM CRON[124254]: (bdsadmin) CMD (docker run -d
bdsdev.azurecr.io/crawler-public)
Mar 20 16:24:02 SpacyVM CRON[124253]: (CRON) info (No MTA installed,
discarding output)
Now, this does run every 2 minutes, per the schedule for debugging purposes, but docker ps -a
shows nothing, even though the containers should have exited and thus should be idle until I use docker rm $(docker ps -aq)
. Has anyone seen this problem before?
Here is my job configured in crontab:
*/2 * * * * docker run -d bdsdev.azurecr.io/crawler-public
Note: I have not created a mailing setup for the cronjobs to output to, hence the No MTA...
error, and I am running this in an Ubuntu VM, not on an Ubuntu docker base image.
Upvotes: 0
Views: 317
Reputation: 13106
Found my problem. When I was originally troubleshooting using grep, my search was omitting a fairly important piece of the log stream. So by using vim to view /var/log/syslog
:
Mar 20 06:34:01 SpacyVM dockerd[1469]: time="2018-03-20T06:34:01.634861659Z" level=info msg="Attempting next endpoint for pull after error: manifest unknown: manifest unknown"
I had made a spelling error in my crontab file, so the image is not able to be located by the docker daemon, causing this problem.
Chalk it up to amateur hour
Upvotes: 1