diff --git a/plugins/providers/docker/driver/compose.rb b/plugins/providers/docker/driver/compose.rb index 92e4e2fd8..804cdad32 100644 --- a/plugins/providers/docker/driver/compose.rb +++ b/plugins/providers/docker/driver/compose.rb @@ -85,7 +85,19 @@ module VagrantPlugins image = params.fetch(:image) links = params.fetch(:links) ports = Array(params[:ports]) - volumes = Array(params[:volumes]) + volumes = Array(params[:volumes]).map do |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 + end cmd = Array(params.fetch(:cmd)) env = Hash[*params.fetch(:env).flatten.map(&:to_s)] expose = Array(params[:expose])