1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 05:49:40 +02:00

feat(container-creation): add the ability to add entries in the container host file

This commit is contained in:
Renato Silva 2017-02-15 19:48:40 -02:00 committed by Anthony Lapenna
parent 38244312c5
commit f1c458b147
2 changed files with 44 additions and 2 deletions

View file

@ -8,7 +8,8 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
Volumes: [],
Registry: '',
NetworkContainer: '',
Labels: []
Labels: [],
ExtraHosts: []
};
$scope.imageConfig = {};
@ -26,7 +27,8 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
PublishAllPorts: false,
Binds: [],
NetworkMode: 'bridge',
Privileged: false
Privileged: false,
ExtraHosts: []
},
Labels: {}
};
@ -63,6 +65,15 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
$scope.formValues.Labels.splice(index, 1);
};
$scope.addExtraHost = function() {
$scope.formValues.ExtraHosts.push({ value: '' });
};
$scope.removeExtraHost = function(index) {
$scope.formValues.ExtraHosts.splice(index, 1);
};
Config.$promise.then(function (c) {
var containersToHideLabels = c.hiddenLabels;
@ -231,6 +242,12 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
networkMode += ':' + containerName;
}
config.HostConfig.NetworkMode = networkMode;
$scope.formValues.ExtraHosts.forEach(function (v) {
if (v.value) {
config.HostConfig.ExtraHosts.push(v.value);
}
});
}
function prepareLabels(config) {