providers/docker: Update driver to docker 0.9

This commit is contained in:
Fabio Rehm 2014-03-27 20:51:44 -03:00 committed by Mitchell Hashimoto
parent de588ba82c
commit e5375715ef
2 changed files with 6 additions and 6 deletions

View File

@ -21,10 +21,10 @@ module VagrantPlugins
name = params.fetch(:name)
cmd = Array(params.fetch(:cmd))
run_cmd = %W(docker run -name #{name} -d)
run_cmd = %W(docker run --name #{name} -d)
run_cmd += ports.map { |p| ['-p', p.to_s] }
run_cmd += volumes.map { |v| ['-v', v.to_s] }
run_cmd += %W(-privileged) if params[:privileged]
run_cmd += %W(--privileged) if params[:privileged]
run_cmd += %W(-h #{params[:hostname]}) if params[:hostname]
run_cmd += [image, cmd]
@ -45,12 +45,12 @@ module VagrantPlugins
end
def created?(cid)
result = execute('docker', 'ps', '-a', '-q', '-notrunc').to_s
result = execute('docker', 'ps', '-a', '-q', '--no-trunc').to_s
result =~ /^#{Regexp.escape cid}$/
end
def running?(cid)
result = execute('docker', 'ps', '-q', '-notrunc')
result = execute('docker', 'ps', '-q', '--no-trunc')
result =~ /^#{Regexp.escape cid}$/m
end
@ -87,7 +87,7 @@ module VagrantPlugins
end
def all_containers
execute('docker', 'ps', '-a', '-q', '-notrunc').to_s.split
execute('docker', 'ps', '-a', '-q', '--no-trunc').to_s.split
end
def docker_bridge_ip

View File

@ -184,7 +184,7 @@ describe VagrantPlugins::DockerProvider::Driver do
before { subject.stub(execute: containers) }
it 'returns an array of all known containers' do
subject.should_receive(:execute).with('docker', 'ps', '-a', '-q', '-notrunc')
subject.should_receive(:execute).with('docker', 'ps', '-a', '-q', '--no-trunc')
expect(subject.all_containers).to eq(['container1', 'container2'])
end
end