Merge pull request #3719 from goshakkk/docker-run-links-fix
Fix docker container linking
This commit is contained in:
commit
66d9f06311
|
@ -31,7 +31,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def create(params, **opts, &block)
|
def create(params, **opts, &block)
|
||||||
image = params.fetch(:image)
|
image = params.fetch(:image)
|
||||||
links = Array(params.fetch(:links))
|
links = params.fetch(:links)
|
||||||
ports = Array(params[:ports])
|
ports = Array(params[:ports])
|
||||||
volumes = Array(params[:volumes])
|
volumes = Array(params[:volumes])
|
||||||
name = params.fetch(:name)
|
name = params.fetch(:name)
|
||||||
|
@ -43,7 +43,7 @@ module VagrantPlugins
|
||||||
run_cmd << "-d" if params[:detach]
|
run_cmd << "-d" if params[:detach]
|
||||||
run_cmd += env.map { |k,v| ['-e', "#{k}=#{v}"] }
|
run_cmd += env.map { |k,v| ['-e', "#{k}=#{v}"] }
|
||||||
run_cmd += expose.map { |p| ['--expose', "#{p}"] }
|
run_cmd += expose.map { |p| ['--expose', "#{p}"] }
|
||||||
run_cmd += links.map { |l| ['--link', "#{l}"] }
|
run_cmd += links.map { |k, v| ['--link', "#{k}:#{v}"] }
|
||||||
run_cmd += ports.map { |p| ['-p', p.to_s] }
|
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] }
|
||||||
run_cmd += %W(--privileged) if params[:privileged]
|
run_cmd += %W(--privileged) if params[:privileged]
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe VagrantPlugins::DockerProvider::Driver do
|
||||||
ports: '8080:80',
|
ports: '8080:80',
|
||||||
volumes: '/host/path:guest/path',
|
volumes: '/host/path:guest/path',
|
||||||
detach: true,
|
detach: true,
|
||||||
links: 'janis:joplin',
|
links: {janis: 'joplin'},
|
||||||
env: {key: 'value'},
|
env: {key: 'value'},
|
||||||
name: cid,
|
name: cid,
|
||||||
hostname: 'jimi-hendrix',
|
hostname: 'jimi-hendrix',
|
||||||
|
@ -43,7 +43,7 @@ describe VagrantPlugins::DockerProvider::Driver do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'links containers' do
|
it 'links containers' do
|
||||||
expect(cmd_executed).to match(/--link #{params[:links]} .+ #{Regexp.escape params[:image]}/)
|
expect(cmd_executed).to match(/--link #{params[:links].to_a.flatten.join(':')} .+ #{Regexp.escape params[:image]}/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets environmental variables' do
|
it 'sets environmental variables' do
|
||||||
|
|
Loading…
Reference in New Issue