Sha256: ac756d9191d48050fbf4248f579ed5ac4a6474f088db2fe1b840915d39c07c59

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

module VagrantPlugins
  module DockerProvisioner
    module Cap
      module Debian
        module DockerConfigureAutoStart
          def self.docker_configure_auto_start(machine)
            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")

                # Wait some amount time for the pid to become available
                # so that we don't start executing Docker commands until
                # it is available.
                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
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 2 versions & 2 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/provisioners/docker/cap/debian/docker_configure_auto_start.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/provisioners/docker/cap/debian/docker_configure_auto_start.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/provisioners/docker/cap/debian/docker_configure_auto_start.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/plugins/provisioners/docker/cap/debian/docker_configure_auto_start.rb