From 5d83c03bfc48407451999f21b0320a1ebb22a8cd Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 12 May 2017 14:05:12 -0700 Subject: [PATCH] Properly handle synced folders in docker provider on WSL --- plugins/providers/docker/driver.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/providers/docker/driver.rb b/plugins/providers/docker/driver.rb index f7a06f195..c845ed2a9 100644 --- a/plugins/providers/docker/driver.rb +++ b/plugins/providers/docker/driver.rb @@ -45,7 +45,19 @@ module VagrantPlugins run_cmd += expose.map { |p| ['--expose', "#{p}"] } run_cmd += links.map { |k, v| ['--link', "#{k}:#{v}"] } run_cmd += ports.map { |p| ['-p', p.to_s] } - run_cmd += volumes.map { |v| ['-v', v.to_s] } + run_cmd += volumes.map { |v| + v = v.to_s + if v.include?(":") && (Vagrant::Util::Platform.windows? || Vagrant::Util::Platform.wsl?) + host, guest = v.split(":", 2) + host = Vagrant::Util::Platform.windows_path(host) + # NOTE: Docker does not support UNC style paths (which also + # means that there's no long path support). Hopefully this + # will be fixed someday and the gsub below can be removed. + host.gsub!(/^[^A-Za-z]+/, "") + v = [host, guest].join(":") + end + ['-v', v.to_s] + } run_cmd += %W(--privileged) if params[:privileged] run_cmd += %W(-h #{params[:hostname]}) if params[:hostname] run_cmd << "-t" if params[:pty]