providers/docker: forward ports properly

This commit is contained in:
Mitchell Hashimoto 2014-05-08 13:37:55 -07:00
parent 471b3b4059
commit aee71a093b
3 changed files with 24 additions and 0 deletions

View File

@ -13,6 +13,7 @@ BUG FIXES:
- core: Don't lock machines on SSH actions. [GH-3664]
- providers/docker: default proxy VM won't use HGFS [GH-3687]
- providers/docker: fix container linking [GH-3719]
- providers/docker: Port settings expose to host properly. [GH-3723]
## 1.6.1 (May 7, 2014)

View File

@ -258,6 +258,7 @@ module VagrantPlugins
b3.use HostMachinePortChecker
b3.use HandleForwardedPortCollisions
b3.use SyncedFolders
b3.use ForwardedPorts
b3.use Create
b3.use WaitForRunning
else
@ -288,6 +289,7 @@ module VagrantPlugins
autoload :Create, action_root.join("create")
autoload :Destroy, action_root.join("destroy")
autoload :DestroyBuildImage, action_root.join("destroy_build_image")
autoload :ForwardedPorts, action_root.join("forwarded_ports")
autoload :HasSSH, action_root.join("has_ssh")
autoload :HostMachine, action_root.join("host_machine")
autoload :HostMachineBuildDir, action_root.join("host_machine_build_dir")

View File

@ -0,0 +1,21 @@
module VagrantPlugins
module DockerProvider
module Action
class ForwardedPorts
def initialize(app, env)
@app = app
end
def call(env)
env[:machine].provider_config.ports.each do |p|
host, guest = p.split(":", 2)
env[:machine].config.vm.network "forwarded_port",
host: host.to_i, guest: guest.to_i
end
@app.call(env)
end
end
end
end
end