diff --git a/plugins/providers/docker/action/create.rb b/plugins/providers/docker/action/create.rb index bf56906da..89034b117 100644 --- a/plugins/providers/docker/action/create.rb +++ b/plugins/providers/docker/action/create.rb @@ -96,10 +96,10 @@ module VagrantPlugins image = @env[:create_image] image ||= @provider_config.image - links = {} + links = [] @provider_config._links.each do |link| parts = link.split(":", 2) - links[parts[0]] = parts[1] + links << parts end { diff --git a/test/unit/plugins/providers/docker/driver_test.rb b/test/unit/plugins/providers/docker/driver_test.rb index cddf6073f..05ac67f88 100644 --- a/test/unit/plugins/providers/docker/driver_test.rb +++ b/test/unit/plugins/providers/docker/driver_test.rb @@ -17,7 +17,7 @@ describe VagrantPlugins::DockerProvider::Driver do ports: '8080:80', volumes: '/host/path:guest/path', detach: true, - links: {janis: 'joplin'}, + links: [[:janis, 'joplin'], [:janis, 'janis']], env: {key: 'value'}, name: cid, hostname: 'jimi-hendrix', @@ -43,7 +43,9 @@ describe VagrantPlugins::DockerProvider::Driver do end it 'links containers' do - expect(cmd_executed).to match(/--link #{params[:links].to_a.flatten.join(':')} .+ #{Regexp.escape params[:image]}/) + params[:links].each do |link| + expect(cmd_executed).to match(/--link #{link.join(':')} .+ #{Regexp.escape params[:image]}/) + end end it 'sets environmental variables' do