Apply container limits to install containers, defaulting to minimums if the server's resources are set too low

This commit is contained in:
Dane Everitt
2021-06-20 17:21:51 -07:00
parent e0078eee0a
commit 8336f6ff29
4 changed files with 79 additions and 14 deletions

View File

@@ -132,7 +132,7 @@ func (e *Environment) InSituUpdate() error {
//
// @see https://github.com/moby/moby/issues/41946
if _, err := e.client.ContainerUpdate(ctx, e.Id, container.UpdateConfig{
Resources: e.resources(),
Resources: e.Configuration.Limits().AsContainerResources(),
}); err != nil {
return errors.Wrap(err, "environment/docker: could not update container")
}
@@ -203,7 +203,7 @@ func (e *Environment) Create() error {
// Define resource limits for the container based on the data passed through
// from the Panel.
Resources: e.resources(),
Resources: e.Configuration.Limits().AsContainerResources(),
DNS: config.Get().Docker.Network.Dns,