fix(container-creation): allow to specify an address in the host port binding (#139)

pull/141/head
Anthony Lapenna 2016-08-17 19:31:06 +12:00 committed by GitHub
parent 29fa33fb2b
commit 496de850c1
1 changed files with 9 additions and 1 deletions

View File

@ -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] = {};
}
});