From 956624c10d926e67d4d2e8bc7fa747980eeeff0d Mon Sep 17 00:00:00 2001 From: Shaunak G Date: Tue, 27 Jul 2021 10:05:13 +1000 Subject: [PATCH] Include `-m` flag in `docker run` call to limit memory per container As per Docker run documentation (https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory), the `-m` flag must be set in order for `--oom-kill-disable` to have the intended effect. Otherwise, an exhaustion of memory in the container will put pressure on the host's processes. This commit sets the max memory to 200MB assuming the t3.small instance has 2GB total. --- supervisor/src/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor/src/main.go b/supervisor/src/main.go index 337d4c8..e95c024 100644 --- a/supervisor/src/main.go +++ b/supervisor/src/main.go @@ -349,6 +349,7 @@ func (sv *supervisor) reload() error { "-p", fmt.Sprintf("127.0.0.1:%d:6119", port), "-e", "FATHOM_SITE_ID", "-e", "RIJU_DEPLOY_CONFIG", + "-m", "200m", "--label", fmt.Sprintf("riju.deploy-config-hash=%s", deployCfgHash), "--name", name, "--restart", "unless-stopped",