Skip to content

Instantly share code, notes, and snippets.

@westurner
Created May 22, 2026 06:33
Show Gist options
  • Select an option

  • Save westurner/e2155e014634cda0329d778641baf6ee to your computer and use it in GitHub Desktop.

Select an option

Save westurner/e2155e014634cda0329d778641baf6ee to your computer and use it in GitHub Desktop.
.devcontainer/podman-rootless
#!/bin/bash
# podman-rootless -- Call through to podman w/ CLI flags for rootless containers
# Usage:
# 1. Include podman-rootless on $PATH:
# sudo cp ./podman-rootless /usr/local/bin/
# ln -s ./podman-rootless ~/.local/bin/
#
# 2. In vscode settings.json:
# "dev.containers.dockerPath": "/home/user/.local/bin/podman-rootless"
if [ -n "${DEBUG_PODMAN_ROOTLESS}" ]; then
echo "$@" >> ~/podman-rootless.log
fi
set -x
PODMAN_RUN_ARGS=${PODMAN_RUN_ARGS:-"--userns=keep-id --security-opt=label=disable"}
cmd=$1
if [ "$cmd" = "run" ] && [ -z "$SKIP_PODMAN_ROOTLESS" ]; then # skip: SC2236
shift
# Use set -- to safely split PODMAN_RUN_ARGS and arguments, then exec
set -- run $PODMAN_RUN_ARGS "$@"
exec podman "$@"
else
exec podman "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment