mirror of
https://github.com/containers/podman.git
synced 2025-12-08 23:00:23 +08:00
Support passing of Ulimits as -1 to mean max
Docker allows the passing of -1 to indicate the maximum limit allowed for the current process. Fixes: https://github.com/containers/podman/issues/19319 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@@ -465,7 +465,7 @@ var _ = Describe("Podman inspect", func() {
|
||||
Expect(inspect[0].NetworkSettings.Networks).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("Container inspect with unlimited uilimits should be -1", func() {
|
||||
It("Container inspect with unlimited ulimits should be -1", func() {
|
||||
ctrName := "testctr"
|
||||
session := podmanTest.Podman([]string{"run", "-d", "--ulimit", "core=-1:-1", "--name", ctrName, ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
||||
@@ -1149,6 +1149,23 @@ EOF
|
||||
assert "$output" =~ " ${nofile2} * ${nofile2} * files"
|
||||
}
|
||||
|
||||
@test "podman run ulimit with -1" {
|
||||
max=unlimited
|
||||
if is_rootless; then
|
||||
run ulimit -c -H
|
||||
max=$output
|
||||
fi
|
||||
|
||||
run_podman run --ulimit core=-1:-1 --rm $IMAGE grep core /proc/self/limits
|
||||
assert "$output" =~ " ${max} * ${max} * bytes"
|
||||
|
||||
run_podman run --ulimit core=1000:-1 --rm $IMAGE grep core /proc/self/limits
|
||||
assert "$output" =~ " 1000 * ${max} * bytes"
|
||||
|
||||
run_podman 125 run --ulimit core=-1:1000 --rm $IMAGE grep core /proc/self/limits
|
||||
is "$output" "Error: ulimit option \"core=-1:1000\" requires name=SOFT:HARD, failed to be parsed: ulimit soft limit must be less than or equal to hard limit: soft: -1 (unlimited), hard: 1000"
|
||||
}
|
||||
|
||||
@test "podman run bad --name" {
|
||||
randomname=$(random_string 30)
|
||||
run_podman 125 create --name "$randomname/bad" $IMAGE
|
||||
|
||||
Reference in New Issue
Block a user