Last active
January 20, 2021 22:15
-
-
Save sjug/d0c1a588ed1cc4ca1d62a59b61bb8685 to your computer and use it in GitHub Desktop.
How podman sets ulimits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEFAULT_CORE_LIMIT=512 | |
SOFT_CORE_LIMIT="${1:-${DEFAULT_CORE_LIMIT}}" | |
HARD_CORE_LIMIT="${2:-${DEFAULT_CORE_LIMIT}}" | |
echo "Starting test container with core ulimit of ${SOFT_CORE_LIMIT}:${HARD_CORE_LIMIT}" | |
sudo podman run -d --rm --ulimit core=${SOFT_CORE_LIMIT}:${HARD_CORE_LIMIT} quay.io/libpod/fedora-minimal:latest sleep 1 | |
echo | |
ULIMIT_PID=$(pgrep sleep) | |
PARENT_PID=$(ps -o ppid= -p ${ULIMIT_PID}) | |
PARENT_CMD=$(ps -o command= ${PARENT_PID}) | |
PID_LIMITS=$(cat /proc/${ULIMIT_PID}/limits | awk 'NR==1 || /core/') | |
echo -e "PID with ulimit set: ${ULIMIT_PID}\n" | |
echo "Parent PID: ${PARENT_PID}" | |
echo -e "Parent CMD:\n${PARENT_CMD}\n" | |
echo -e "Core limit of PID:\n${PID_LIMITS}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment