2013-11-26 21:48:51 +00:00
|
|
|
module VagrantPlugins
|
2014-03-26 23:32:31 +00:00
|
|
|
module DockerProvisioner
|
2013-11-26 21:48:51 +00:00
|
|
|
module Cap
|
|
|
|
module Debian
|
|
|
|
module DockerConfigureAutoStart
|
|
|
|
def self.docker_configure_auto_start(machine)
|
2014-01-22 04:52:27 +00:00
|
|
|
machine.communicate.tap do |comm|
|
|
|
|
if !comm.test('grep -q \'\-r=true\' /etc/default/docker')
|
|
|
|
comm.sudo("echo 'DOCKER_OPTS=\"-r=true ${DOCKER_OPTS}\"' >> /etc/default/docker")
|
|
|
|
comm.sudo("stop docker")
|
|
|
|
comm.sudo("start docker")
|
2014-04-15 19:15:14 +00:00
|
|
|
|
|
|
|
# Wait some amount time for the pid to become available
|
|
|
|
# so that we don't start executing Docker commands until
|
|
|
|
# it is available.
|
2014-04-15 19:18:37 +00:00
|
|
|
if machine.guest.capability?(:docker_daemon_running)
|
|
|
|
[0, 1, 2, 4].each do |delay|
|
|
|
|
sleep delay
|
|
|
|
break if machine.guest.capability(:docker_daemon_running)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
# This OS doesn't support checking if Docker is running,
|
|
|
|
# so just wait 5 seconds.
|
|
|
|
sleep 5
|
2014-04-15 18:32:05 +00:00
|
|
|
end
|
2014-01-22 04:52:27 +00:00
|
|
|
end
|
2013-11-26 21:48:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|