mirror of https://github.com/portainer/portainer
fix(container-creation): allow to specify an address in the host port binding (#139)
parent
29fa33fb2b
commit
496de850c1
|
@ -150,7 +150,15 @@ function ($scope, $state, Config, Container, Image, Volume, Network, Messages, e
|
||||||
config.HostConfig.PortBindings.forEach(function (portBinding) {
|
config.HostConfig.PortBindings.forEach(function (portBinding) {
|
||||||
if (portBinding.hostPort && portBinding.containerPort) {
|
if (portBinding.hostPort && portBinding.containerPort) {
|
||||||
var key = portBinding.containerPort + "/" + portBinding.protocol;
|
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] = {};
|
config.ExposedPorts[key] = {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue