mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
feat: add setting to change DNS servers
This commit is contained in:
parent
efae49d92b
commit
4cb6329d13
2 changed files with 37 additions and 3 deletions
|
@ -21,6 +21,8 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
|||
MacAddress: '',
|
||||
IPv4: '',
|
||||
IPv6: '',
|
||||
Dns1: '',
|
||||
Dns2: '',
|
||||
AccessControlData: new AccessControlFormData(),
|
||||
CpuLimit: 0,
|
||||
MemoryLimit: 0,
|
||||
|
@ -215,6 +217,15 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
|||
config.NetworkingConfig.EndpointsConfig[networkMode].Aliases = _.filter(aliases, (o) => { return !_.startsWith($scope.fromContainer.Id,o)});
|
||||
}
|
||||
|
||||
var dnsServers = [];
|
||||
if ($scope.formValues.Dns1) {
|
||||
dnsServers.push($scope.formValues.Dns1);
|
||||
}
|
||||
if ($scope.formValues.Dns2) {
|
||||
dnsServers.push($scope.formValues.Dns2);
|
||||
}
|
||||
config.HostConfig.Dns = dnsServers;
|
||||
|
||||
$scope.formValues.ExtraHosts.forEach(function (v) {
|
||||
if (v.value) {
|
||||
config.HostConfig.ExtraHosts.push(v.value);
|
||||
|
@ -387,6 +398,13 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
|||
}
|
||||
$scope.formValues.MacAddress = d.Config.MacAddress;
|
||||
|
||||
if (d.HostConfig.Dns[0]) {
|
||||
$scope.formValues.Dns1 = d.HostConfig.Dns[0];
|
||||
}
|
||||
if (d.HostConfig.Dns[1]) {
|
||||
$scope.formValues.Dns2 = d.HostConfig.Dns[1];
|
||||
}
|
||||
|
||||
// ExtraHosts
|
||||
if ($scope.config.HostConfig.ExtraHosts) {
|
||||
var extraHosts = $scope.config.HostConfig.ExtraHosts;
|
||||
|
|
|
@ -435,6 +435,22 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- !ipv6-input -->
|
||||
<!-- dns1-input -->
|
||||
<div class="form-group">
|
||||
<label for="container_dns1" class="col-sm-2 col-lg-1 control-label text-left">DNS Server 1</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="formValues.Dns1" id="container_dns1" placeholder="e.g. 1.1.1.1">
|
||||
</div>
|
||||
</div>
|
||||
<!-- !dns1-input -->
|
||||
<!-- dns2-input -->
|
||||
<div class="form-group">
|
||||
<label for="container_dns2" class="col-sm-2 col-lg-1 control-label text-left">DNS Server 2</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="formValues.Dns2" id="container_dns2" placeholder="e.g. 8.8.8.8">
|
||||
</div>
|
||||
</div>
|
||||
<!-- !dns2-input -->
|
||||
<!-- extra-hosts-variables -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12" style="margin-top: 5px;">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue