Don't limit the size on /run for systemd based containers

We had a customer incident where they ran out of space on /run.

If you don't specify size, it will be still limited to 50% or memory
available in the cgroup the container is running in.  If the cgroup is
unlimited then the /run will be limited to 50% of the total memory
on the system.

Also /run is mounted on the host as exec, so no reason for us to mount
it noexec.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2020-08-17 16:24:56 -04:00
parent 748e8829da
commit bd63a252f3
2 changed files with 2 additions and 8 deletions

View File

@ -88,17 +88,11 @@ func parseVolumes(volumeFlag, mountFlag, tmpfsFlag []string, addReadOnlyTmpfs bo
if _, ok := unifiedVolumes[dest]; ok { if _, ok := unifiedVolumes[dest]; ok {
continue continue
} }
localOpts := options
if dest == "/run" {
localOpts = append(localOpts, "noexec", "size=65536k")
} else {
localOpts = append(localOpts, "exec")
}
unifiedMounts[dest] = spec.Mount{ unifiedMounts[dest] = spec.Mount{
Destination: dest, Destination: dest,
Type: TypeTmpfs, Type: TypeTmpfs,
Source: "tmpfs", Source: "tmpfs",
Options: localOpts, Options: options,
} }
} }
} }

View File

@ -571,7 +571,7 @@ func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) erro
Destination: dest, Destination: dest,
Type: "tmpfs", Type: "tmpfs",
Source: "tmpfs", Source: "tmpfs",
Options: append(options, "tmpcopyup", "size=65536k"), Options: append(options, "tmpcopyup"),
} }
g.AddMount(tmpfsMnt) g.AddMount(tmpfsMnt)
} }