Disable swap in Docker/podman by setting --memory-swap to --memory

pull/9149/head
Thomas Stromberg 2020-09-01 13:57:52 -07:00
parent 51a3155cfd
commit 7fc0299c6f
1 changed files with 6 additions and 1 deletions

View File

@ -177,9 +177,14 @@ func CreateContainerNode(p CreateParams) error {
if p.OCIBinary == Podman && memcgSwap { // swap is required for memory
runArgs = append(runArgs, fmt.Sprintf("--memory=%s", p.Memory))
// Disable swap by setting the value to match
runArgs = append(runArgs, fmt.Sprintf("--memory-swap=%s", p.Memory))
}
if p.OCIBinary == Docker { // swap is only required for --memory-swap
if p.OCIBinary == Docker {
runArgs = append(runArgs, fmt.Sprintf("--memory=%s", p.Memory))
// Disable swap by setting the value to match
runArgs = append(runArgs, fmt.Sprintf("--memory-swap=%s", p.Memory))
}
// https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface/