From 496de850c101de2194b01aebd6738f9d8b65d477 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 17 Aug 2016 19:31:06 +1200 Subject: [PATCH] fix(container-creation): allow to specify an address in the host port binding (#139) --- .../createContainer/createContainerController.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/components/createContainer/createContainerController.js b/app/components/createContainer/createContainerController.js index 70ef048aa..623da4eb8 100644 --- a/app/components/createContainer/createContainerController.js +++ b/app/components/createContainer/createContainerController.js @@ -150,7 +150,15 @@ function ($scope, $state, Config, Container, Image, Volume, Network, Messages, e config.HostConfig.PortBindings.forEach(function (portBinding) { if (portBinding.hostPort && portBinding.containerPort) { var key = portBinding.containerPort + "/" + portBinding.protocol; - bindings[key] = [{ HostPort: portBinding.hostPort }]; + var binding = {}; + if (portBinding.hostPort.indexOf(':') > -1) { + var hostAndPort = portBinding.hostPort.split(':'); + binding.HostIp = hostAndPort[0]; + binding.HostPort = hostAndPort[1]; + } else { + binding.HostPort = portBinding.hostPort; + } + bindings[key] = [binding]; config.ExposedPorts[key] = {}; } });