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:
parent
38244312c5
commit
f1c458b147
2 changed files with 44 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue