diff --git a/plugins/providers/docker/config.rb b/plugins/providers/docker/config.rb index 05af800c1..84d195d1a 100644 --- a/plugins/providers/docker/config.rb +++ b/plugins/providers/docker/config.rb @@ -22,6 +22,11 @@ module VagrantPlugins # @return [Hash] attr_accessor :env + # Force using a proxy VM, even on Linux hosts. + # + # @return [Boolean] + attr_accessor :force_host_vm + # True if the Docker container exposes SSH access. If this is true, # then Vagrant can do a bunch more things like setting the hostname, # provisioning, etc. @@ -66,6 +71,7 @@ module VagrantPlugins @cmd = UNSET_VALUE @create_args = [] @env = {} + @force_host_vm = UNSET_VALUE @has_ssh = UNSET_VALUE @image = UNSET_VALUE @name = UNSET_VALUE @@ -100,6 +106,7 @@ module VagrantPlugins @cmd = [] if @cmd == UNSET_VALUE @create_args = [] if @create_args == UNSET_VALUE @env ||= {} + @force_host_vm = false if @force_host_vm == UNSET_VALUE @has_ssh = false if @has_ssh == UNSET_VALUE @image = nil if @image == UNSET_VALUE @name = nil if @name == UNSET_VALUE diff --git a/plugins/providers/docker/provider.rb b/plugins/providers/docker/provider.rb index cc5df52b8..27d7fa2d6 100644 --- a/plugins/providers/docker/provider.rb +++ b/plugins/providers/docker/provider.rb @@ -118,10 +118,8 @@ module VagrantPlugins # rather than directly on our system. Docker needs to run in a VM # when we're not on Linux, or not on a Linux that supports Docker. def host_vm? - # TODO: It'd be nice to also check if Docker supports the version - # of Linux that Vagrant is running on so that we can spin up a VM - # on old versions of Linux as well. - !Vagrant::Util::Platform.linux? + @machine.provider_config.force_host_vm || + !Vagrant::Util::Platform.linux? end # Returns the SSH info for accessing the Container. diff --git a/test/unit/plugins/providers/docker/config_spec.rb b/test/unit/plugins/providers/docker/config_spec.rb index 376067e1b..ceb435b81 100644 --- a/test/unit/plugins/providers/docker/config_spec.rb +++ b/test/unit/plugins/providers/docker/config_spec.rb @@ -41,6 +41,7 @@ describe VagrantPlugins::DockerProvider::Config do its(:build_dir) { should be_nil } its(:cmd) { should eq([]) } its(:env) { should eq({}) } + its(:force_host_vm) { should be_false } its(:image) { should be_nil } its(:name) { should be_nil } its(:privileged) { should be_false }