chore(telemetry): add an arguement to select conatiner runtime explicitly (#3896)

# What does this PR do?


## Test Plan
❯ ./scripts/telemetry/setup_telemetry.sh --container docker
This commit is contained in:
ehhuang 2025-10-23 12:36:34 -07:00 committed by GitHub
parent 658fb2c777
commit d12e5f0999
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,14 +16,59 @@
set -Eeuo pipefail
if command -v podman &> /dev/null; then
CONTAINER_RUNTIME="podman"
elif command -v docker &> /dev/null; then
CONTAINER_RUNTIME="docker"
else
echo "🚨 Neither Podman nor Docker could be found"
echo "Install Docker: https://docs.docker.com/get-docker/ or Podman: https://podman.io/getting-started/installation"
exit 1
# Parse arguments
CONTAINER_RUNTIME=""
print_usage() {
echo "Usage: $0 [--container docker|podman]"
echo ""
echo "Options:"
echo " -c, --container Choose container runtime (docker or podman)."
echo " -h, --help Show this help."
}
while [[ $# -gt 0 ]]; do
case "$1" in
-c|--container)
if [[ $# -lt 2 ]]; then
echo "🚨 --container requires a value: docker or podman"
exit 1
fi
case "$2" in
docker|podman)
CONTAINER_RUNTIME="$2"
shift 2
;;
*)
echo "🚨 Invalid container runtime: $2"
echo "Valid options are: docker, podman"
exit 1
;;
esac
;;
-h|--help)
print_usage
exit 0
;;
*)
echo "🚨 Unknown argument: $1"
print_usage
exit 1
;;
esac
done
# Detect container runtime if not specified
if [[ -z "$CONTAINER_RUNTIME" ]]; then
if command -v podman &> /dev/null; then
CONTAINER_RUNTIME="podman"
elif command -v docker &> /dev/null; then
CONTAINER_RUNTIME="docker"
else
echo "🚨 Neither Podman nor Docker could be found"
echo "Install Docker: https://docs.docker.com/get-docker/ or Podman: https://podman.io/getting-started/installation"
exit 1
fi
fi
echo "🚀 Setting up telemetry stack for Llama Stack using $CONTAINER_RUNTIME..."