Merge pull request #10100 from briancain/DOCKER-TOOLBOX
Convert windows paths for volume mounts on docker driver
This commit is contained in:
commit
c2cff0dc07
|
@ -49,6 +49,13 @@ module VagrantPlugins
|
||||||
run_cmd += volumes.map { |v|
|
run_cmd += volumes.map { |v|
|
||||||
v = v.to_s
|
v = v.to_s
|
||||||
if v.include?(":") && @executor.windows?
|
if v.include?(":") && @executor.windows?
|
||||||
|
if v.index(":") != v.rindex(":")
|
||||||
|
# If we have 2 colons, the host path is an absolute Windows URL
|
||||||
|
# and we need to remove the colon from it
|
||||||
|
host, colon, guest = v.rpartition(":")
|
||||||
|
host = "//" + host[0].downcase + host[2..-1]
|
||||||
|
v = [host, guest].join(":")
|
||||||
|
else
|
||||||
host, guest = v.split(":", 2)
|
host, guest = v.split(":", 2)
|
||||||
host = Vagrant::Util::Platform.windows_path(host)
|
host = Vagrant::Util::Platform.windows_path(host)
|
||||||
# NOTE: Docker does not support UNC style paths (which also
|
# NOTE: Docker does not support UNC style paths (which also
|
||||||
|
@ -57,6 +64,8 @@ module VagrantPlugins
|
||||||
host.gsub!(/^[^A-Za-z]+/, "")
|
host.gsub!(/^[^A-Za-z]+/, "")
|
||||||
v = [host, guest].join(":")
|
v = [host, guest].join(":")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
['-v', v.to_s]
|
['-v', v.to_s]
|
||||||
}
|
}
|
||||||
run_cmd += %W(--privileged) if params[:privileged]
|
run_cmd += %W(--privileged) if params[:privileged]
|
||||||
|
|
|
@ -65,6 +65,33 @@ describe VagrantPlugins::DockerProvider::Driver do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#create windows' do
|
||||||
|
let(:params) { {
|
||||||
|
image: 'jimi/hendrix:eletric-ladyland',
|
||||||
|
cmd: ['play', 'voodoo-chile'],
|
||||||
|
ports: '8080:80',
|
||||||
|
volumes: 'C:/Users/BobDylan/AllAlong:/The/Watchtower',
|
||||||
|
detach: true,
|
||||||
|
links: [[:janis, 'joplin'], [:janis, 'janis']],
|
||||||
|
env: {key: 'value'},
|
||||||
|
name: cid,
|
||||||
|
hostname: 'jimi-hendrix',
|
||||||
|
privileged: true
|
||||||
|
} }
|
||||||
|
|
||||||
|
let(:translated_path) { "//c/Users/BobDylan/AllAlong:/The/Watchtower" }
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(Vagrant::Util::Platform).to receive(:windows?).and_return(true)
|
||||||
|
subject.create(params)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shares folders' do
|
||||||
|
expect(cmd_executed).to match(/-v #{translated_path} .+ #{Regexp.escape params[:image]}/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
describe '#created?' do
|
describe '#created?' do
|
||||||
let(:result) { subject.created?(cid) }
|
let(:result) { subject.created?(cid) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue