简体   繁体   中英

CronJob not able to start docker container

I am trying to run a container using cronjob however my cron is not able to run container.

I have a cron task to invoke orchestrate.sh which starts a container

crontab -l

27 22 08 * * /tmp/compose/orchestrate.sh >> /var/log/composeerr.log
#have a newline

orchestrate.sh

#!/bin/bash -v
/usr/bin/docker run -d hello/helloworld:latest >> /somerror.log

somerror.log has a container id , however docker ps on host is not showing it.

If I run the command /usr/bin/docker run -d hello/helloworld:latest >> /somerror.log on host its bringing the container up.

What am I missing?

The user the cronjob is running under must be able to start a docker container. On linux this is often the root user or a user added to that group.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM