mirror of https://github.com/containers/podman.git
podman run --memory=0 ... should not set memory limit
On Docker this is ignored, and it should be on Podman as well. This is documented in the man page. Fixes: https://github.com/containers/podman/issues/12002 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
82fd2999b2
commit
20b5a8599b
|
@ -133,6 +133,7 @@ func getMemoryLimits(s *specgen.SpecGenerator, c *entities.ContainerCreateOption
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "invalid value for memory")
|
return nil, errors.Wrapf(err, "invalid value for memory")
|
||||||
}
|
}
|
||||||
|
if ml > 0 {
|
||||||
memory.Limit = &ml
|
memory.Limit = &ml
|
||||||
if c.MemorySwap == "" {
|
if c.MemorySwap == "" {
|
||||||
limit := 2 * ml
|
limit := 2 * ml
|
||||||
|
@ -140,6 +141,7 @@ func getMemoryLimits(s *specgen.SpecGenerator, c *entities.ContainerCreateOption
|
||||||
}
|
}
|
||||||
hasLimits = true
|
hasLimits = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if m := c.MemoryReservation; len(m) > 0 {
|
if m := c.MemoryReservation; len(m) > 0 {
|
||||||
mr, err := units.RAMInBytes(m)
|
mr, err := units.RAMInBytes(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -67,6 +67,11 @@ echo $rand | 0 | $rand
|
||||||
is "$output" ".*invalidflag" "failed when passing undefined flags to the runtime"
|
is "$output" ".*invalidflag" "failed when passing undefined flags to the runtime"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman run --memory=0 runtime option" {
|
||||||
|
run_podman run --memory=0 --rm $IMAGE echo hello
|
||||||
|
is "$output" "hello" "failed to run when --memory is set to 0"
|
||||||
|
}
|
||||||
|
|
||||||
# 'run --preserve-fds' passes a number of additional file descriptors into the container
|
# 'run --preserve-fds' passes a number of additional file descriptors into the container
|
||||||
@test "podman run --preserve-fds" {
|
@test "podman run --preserve-fds" {
|
||||||
skip_if_remote "preserve-fds is meaningless over remote"
|
skip_if_remote "preserve-fds is meaningless over remote"
|
||||||
|
|
Loading…
Reference in New Issue