mirror of https://github.com/portainer/portainer
fix(container-creation): preserve network aliases (#3401)
parent
7f54584ed6
commit
61c38534a7
|
@ -71,8 +71,16 @@ angular.module('portainer.docker')
|
|||
return Network.disconnect({ id: networkId }, { Container: containerId, Force: force }).$promise;
|
||||
};
|
||||
|
||||
service.connectContainer = function(networkId, containerId) {
|
||||
return Network.connect({ id: networkId }, { Container: containerId }).$promise;
|
||||
service.connectContainer = function(networkId, containerId, aliases) {
|
||||
var payload = {
|
||||
Container: containerId,
|
||||
};
|
||||
if (aliases) {
|
||||
payload.EndpointConfig = {
|
||||
Aliases: aliases,
|
||||
}
|
||||
}
|
||||
return Network.connect({ id: networkId }, payload).$promise;
|
||||
};
|
||||
|
||||
return service;
|
||||
|
|
|
@ -208,7 +208,8 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
|||
IPAMConfig: {
|
||||
IPv4Address: $scope.formValues.IPv4,
|
||||
IPv6Address: $scope.formValues.IPv6
|
||||
}
|
||||
},
|
||||
Aliases: _.without($scope.config.NetworkingConfig.EndpointsConfig[networkMode].Aliases, $scope.config.Hostname)
|
||||
};
|
||||
|
||||
$scope.formValues.ExtraHosts.forEach(function (v) {
|
||||
|
@ -780,9 +781,9 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
|||
return $q.when();
|
||||
}
|
||||
|
||||
var connectionPromises = Object.keys($scope.extraNetworks).map(function (networkName) {
|
||||
return NetworkService.connectContainer(networkName, newContainerId);
|
||||
});
|
||||
var connectionPromises = _.forOwn($scope.extraNetworks, function (network, networkName) {
|
||||
return NetworkService.connectContainer(networkName, newContainerId, _.without(network.Aliases, $scope.config.Hostname));
|
||||
});
|
||||
|
||||
return $q.all(connectionPromises);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,8 @@ module.exports = {
|
|||
// new BundleAnalyzerPlugin()
|
||||
new LodashModuleReplacementPlugin({
|
||||
shorthands: true,
|
||||
collections: true
|
||||
collections: true,
|
||||
paths: true
|
||||
}),
|
||||
new DefinePlugin({
|
||||
__CONFIG_GA_ID: JSON.stringify(pkg.config.GA_ID),
|
||||
|
|
Loading…
Reference in New Issue