Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nerdctl run: reset the default value of limits. #2682

Merged
merged 1 commit into from
Dec 9, 2023

Conversation

jiusanzhou
Copy link
Contributor

With the oci spec, we have the default rlimits RLIMIT_NOFILE=1024:1024, If we start a pod in kubelet, this value we be reset to nil by cri. We use the nerdctl to start containers in production, this difference will cause user confused.

When run a container if don't get any ulimit opts, reset the rlimits to nil. This will remove the default 1024 file limit.

if len(ulimitOpts) == 0 {
	ulimitOpts = append(ulimitOpts, withRlimits(nil))
}

Warning: this PR will make nerdctl run behave differently than before.

With the oci spec, we have the default rlimits RLIMIT_NOFILE=1024:1024,
If we start a pod in kubelet, this value we be reset to nil by cri.
We use the nerdctl to start containers in production, this difference
will cause user confused.

When run a container if don't get any ulimit opts, reset the rlimits
to nil. This will remove the default 1024 file limit.
```go
if len(ulimitOpts) == 0 {
	ulimitOpts = append(ulimitOpts, withRlimits(nil))
}
```

Warning: this PR will make `nerdctl run` behave differently than before.
Signed-off-by: Zoe <[email protected]>
Copy link
Contributor

@yankay yankay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jiusanzhou

I've invesgated, the behavior is also compatible Docker.

@AkihiroSuda
Copy link
Member

Can we have a test?

@AkihiroSuda AkihiroSuda added this to the v1.7.2 milestone Dec 9, 2023
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'm merging this, but please consider adding tests to prevent regression in future

@AkihiroSuda AkihiroSuda merged commit 61e0d16 into containerd:main Dec 9, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants