Docker client hardcodes --oom-score-adj=0 by default, while the expected default would be to *NOT* change oom score adj
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
Hi,
As described in https://github.com/containers/podman/issues/19930#issuecomment-1715401284 it seems that currently in the docker client code, the default value of oomScoreAdj https://github.com/docker/cli/blob/843951e84a4a0326e3309a1658e572fd359cd14f/cli/command/container/opts.go#L92 is zero, which is unexpected. The right default value for this value should be nil (ie explicitly not provided by the user, so the container engine shall not try to set the oom score adjutement). When docker is used as a client to target podman, podman thinks the user explicitly provided 0 while most of the time people don't even set this.
Would it be possible to change the type of this oomScoreAdj to some "optional int" (I don't know how this is best written in go, as I am not myself a go developer) ?
Reproduce
Given the description, I don't think reproduction steps are needed.
Expected behavior
0 shouldn't be the default behavior of oomScoreAdj, it should be nil and no value passed to the docker deamon.
docker version
Any docker version
docker info
Not needed
Additional Info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in cli/command/container/opts.go at the oomScoreAdj handling referenced by the issue, and trace how its default reaches the Docker daemon request. Done means an omitted setting remains unset rather than being sent as 0; verify the behavior with the relevant Docker CLI checks available around this entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100