Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
11 events
when toggle format what by license comment
Dec 10, 2015 at 17:34 answer added Lee Netherton timeline score: 1
Oct 21, 2014 at 15:30 answer added ISanych timeline score: 3
Aug 6, 2014 at 9:38 vote accept Programster
Aug 6, 2014 at 9:38 answer added Programster timeline score: 4
Aug 6, 2014 at 9:30 comment added Programster I'm afraid commands like sudo /usr/sbin/service "docker" "start" && /usr/bin/docker run -d [IMAGE ID] appear to never run the second half. I am guessing this is because && only works if the previous command succeeds and if the docker service is already running is not considered successful?
Aug 1, 2014 at 14:41 comment added Chris McKinnel Yeah so if you take a look inside /etc/init.d/docker, you'll see that calling start uses the --background option to start-stop-daemon which means it's still doing stuff when it returns.
Aug 1, 2014 at 12:49 comment added Programster @Chris McKinnel are you saying that my call to sudo /usr/sbin/service docker start is non-blocking and it will immediately move onto the next line: sudo /usr/bin/docker run -d 91b5261e2dc0 before the daemon has finished starting?
Aug 1, 2014 at 12:15 comment added Chris McKinnel That's fine, at least you know now that the docker daemon isn't starting in time for you to start your container. What about using && at the end of the start command? You're effectively saying "When you're done starting the docker daemon, start the container". Basically the same as wait, though.
Aug 1, 2014 at 11:46 comment added Programster Adding a sleep 10 has "fixed" the issue temporarily, but I would rather not have to rely on a race condition. I am not running as root, but the default "ubuntu" user, hence the calls to sudo
Aug 1, 2014 at 10:37 comment added Chris McKinnel Try adding a wait command (or a &&) after your first command in start-container.sh, failing that - are you sure your cron job is running as root? Try @reboot root /bin/bash start-container.sh ...
Aug 1, 2014 at 10:02 history asked Programster CC BY-SA 3.0