lib/vocker/docker_client.rb in vocker-0.3.0 vs lib/vocker/docker_client.rb in vocker-0.3.1

- old
+ new

@@ -44,10 +44,16 @@ def container_exist?(id) @machine.communicate.test("sudo docker ps -a -q | grep -q #{id}") end def start_container(id) - @machine.communicate.sudo("docker start #{id}") + unless container_running?(id) + @machine.communicate.sudo("docker start #{id}") + end + end + + def container_running?(id) + @machine.communicate.test("sudo docker ps -q | grep #{id}") end def create_container(config) args = "-cidfile=#{config[:cidfile]} -d" args << " -dns=#{config[:dns]}" if config[:dns]