Podman container with memory limit

Sub-cards (0)Archived
Comments (2)
Reply
systemd-run --user --scope -p MemoryHigh=8G -p MemoryMax=10G -p MemorySwapMax=0 ./script.sh

This systemd-run command limits the available memory but unlike podman does not isolate the process.

Reply
podman run -v $DIR:/root -m 10g -it --rm haskell:8.10 bash
  1. -v $DIR:/root mounts $DIR (host) to /root (container)

  2. -m 10g limits the memory to 10 GiB

  3. -it (interactive+tty) creates an interactive session

  4. --rm removes the container after exit

  5. haskell:8.10 provides GHC 8.10.7

  6. bash is the command to execute