polonskiy / crowdr

Crowdr is a tool for managing multiple Docker containers
MIT License
95 stars 9 forks source link

Add start_wait_sec and stop_delay_sec options #8

Closed marcinwaldowski closed 8 years ago

marcinwaldowski commented 8 years ago

This change add two options:

polonskiy commented 8 years ago

:+1:

Maybe we can make a more general approach. Something like before/after hooks, but for each container. Such solution will allow us to put simple sleep 2 there or wait for a certain port:

while ! nc -q 1 $ip 3306 </dev/null >/dev/null; do
    sleep 1
done

What do you think? @marcinwaldowski @coderofsalvation

marcinwaldowski commented 8 years ago

I like your idea better than my :)

I'm not experienced in bash programming. Can we implement it in such a way that in case of very simple things (like sleep 5) the body of container hook could be included in-line in crowdr.cfg.sh file?

coderofsalvation commented 8 years ago

+1 for the port polling solution

I had the same problem, I have a crowdr-hook which would sleep x amount of seconds, before it would append some servernames to the /etc/hosts-file of a container. This doesn't work always :D

byrnedo commented 8 years ago

Just after seeing this pull request only once I'd created my own : #10

I added hooks for run, rmi and build, looks like this in the cfg:

 ...
 redis hook run.after sleep 5
 ...
polonskiy commented 8 years ago

Implemented in 0.9.0.