diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2023-04-12 23:37:43 +0200 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2023-04-13 00:02:39 +0200 |
commit | 5a922dc162bbe0a03450165da4e6aceca55073d4 (patch) | |
tree | b40ee77501c41c54429036869102774d82bad941 /cmd/dockerd/config_unix.go | |
parent | 49fa3d82b75749a96fdb4bbc2092d9495b9dfdd9 (diff) | |
download | docker-5a922dc162bbe0a03450165da4e6aceca55073d4.tar.gz |
daemon: deprecate --oom-score-adjust for the daemon
The `oom-score-adjust` option was added in a894aec8d81de5484152a76d76b80809df9edd71,
to prevent the daemon from being OOM-killed before other processes. This
option was mostly added as a "convenience", as running the daemon as a
systemd unit was not yet common.
Having the daemon set its own limits is not best-practice, and something
better handled by the process-manager starting the daemon.
Commit cf7a5be0f2ee8bb4a3f7961682e13b89bc625299 fixed this option to allow
disabling it, and 2b8e68ef06ca3daf2b0e17e51ba72999773b6270 removed the default
score adjust.
This patch deprecates the option altogether, recommending users to set these
limits through the process manager used, such as the "OOMScoreAdjust" option
in systemd units.
With this patch:
dockerd --oom-score-adjust=-500 --validate
Flag --oom-score-adjust has been deprecated, and will be removed in the next release.
configuration OK
echo '{"oom-score-adjust":-500}' > /etc/docker/daemon.json
dockerd
INFO[2023-04-12T21:34:51.133389627Z] Starting up
INFO[2023-04-12T21:34:51.135607544Z] containerd not running, starting managed containerd
WARN[2023-04-12T21:34:51.135629086Z] DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" option will be removed in the next release.
docker info
Client:
Context: default
Debug Mode: false
...
DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" option will be removed in the next release
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'cmd/dockerd/config_unix.go')
-rw-r--r-- | cmd/dockerd/config_unix.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/dockerd/config_unix.go b/cmd/dockerd/config_unix.go index e76c962422..b0aa098edb 100644 --- a/cmd/dockerd/config_unix.go +++ b/cmd/dockerd/config_unix.go @@ -46,7 +46,8 @@ func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) error { flags.StringVar(&conf.CgroupParent, "cgroup-parent", "", "Set parent cgroup for all containers") flags.StringVar(&conf.RemappedRoot, "userns-remap", "", "User/Group setting for user namespaces") flags.BoolVar(&conf.LiveRestoreEnabled, "live-restore", false, "Enable live restore of docker when containers are still running") - flags.IntVar(&conf.OOMScoreAdjust, "oom-score-adjust", 0, "Set the oom_score_adj for the daemon") + flags.IntVar(&conf.OOMScoreAdjust, "oom-score-adjust", 0, "Set the oom_score_adj for the daemon (deprecated)") + _ = flags.MarkDeprecated("oom-score-adjust", "and will be removed in the next release.") flags.BoolVar(&conf.Init, "init", false, "Run an init in the container to forward signals and reap processes") flags.StringVar(&conf.InitPath, "init-path", "", "Path to the docker-init binary") flags.Int64Var(&conf.CPURealtimePeriod, "cpu-rt-period", 0, "Limit the CPU real-time period in microseconds for the parent cgroup for all containers (not supported with cgroups v2)") |