diff --git a/CHANGELOG.md b/CHANGELOG.md index ef2f3f626..56009a921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/plugins/providers/docker/action.rb b/plugins/providers/docker/action.rb index f7580fa7a..13a64a4e8 100644 --- a/plugins/providers/docker/action.rb +++ b/plugins/providers/docker/action.rb @@ -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") diff --git a/plugins/providers/docker/action/forwarded_ports.rb b/plugins/providers/docker/action/forwarded_ports.rb new file mode 100644 index 000000000..db78c33ac --- /dev/null +++ b/plugins/providers/docker/action/forwarded_ports.rb @@ -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