mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(docker): allow docker container resource settings without restart EE-1942 (#6065)
Co-authored-by: sam <sam@allofword> Co-authored-by: sam@gemibook <huapox@126.com> Co-authored-by: Prabhat Khera <prabhat.khera@gmail.com>
This commit is contained in:
parent
c267355759
commit
1e80061186
5 changed files with 173 additions and 54 deletions
|
@ -90,11 +90,26 @@ angular.module('portainer.docker').factory('ContainerService', [
|
|||
};
|
||||
|
||||
service.updateRestartPolicy = updateRestartPolicy;
|
||||
service.updateLimits = updateLimits;
|
||||
|
||||
function updateRestartPolicy(id, restartPolicy, maximumRetryCounts) {
|
||||
return Container.update({ id: id }, { RestartPolicy: { Name: restartPolicy, MaximumRetryCount: maximumRetryCounts } }).$promise;
|
||||
}
|
||||
|
||||
function updateLimits(id, config) {
|
||||
return Container.update(
|
||||
{ id: id },
|
||||
{
|
||||
// MemorySwap: must be set
|
||||
// -1: non limits, 0: treated as unset(cause update error).
|
||||
MemoryReservation: config.HostConfig.MemoryReservation,
|
||||
Memory: config.HostConfig.Memory,
|
||||
MemorySwap: -1,
|
||||
NanoCpus: config.HostConfig.NanoCpus,
|
||||
}
|
||||
).$promise;
|
||||
}
|
||||
|
||||
service.createContainer = function (configuration) {
|
||||
var deferred = $q.defer();
|
||||
Container.create(configuration)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue