Skip to content

Instantly share code, notes, and snippets.

@bmaupin
Last active November 21, 2023 13:02
Show Gist options
  • Save bmaupin/a83ba1c3f69741be720f262c92133eca to your computer and use it in GitHub Desktop.
Save bmaupin/a83ba1c3f69741be720f262c92133eca to your computer and use it in GitHub Desktop.
Run podman on RHEL 7 with Vagrant without root

More information: Basic Setup and Use of Podman in a Rootless environment

  1. Enable user namespaces

    sudo sh -c 'echo "user.max_user_namespaces=15000" > /etc/sysctl.d/42-rootless.conf'
    sudo sysctl --system
    

    Fixes this error:

    cannot clone: Invalid argument
    user namespaces are not enabled in /proc/sys/user/max_user_namespaces
    Error: could not get runtime: cannot re-exec process
    

    More information:

  2. /etc/subuid and /etc/subgid configuration

    sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 vagrant
    

    Fixes this error:

      Error processing tar file(exit status 1): there might not be enough IDs available in the namespace (requested 0:5 for /usr/bin/write): lchown /usr/bin/write: invalid argument
    

    ⚠ If you encounter this error after podman is already installed, you'll also need to run:

    podman system migrate
    

    More information:

  3. Install podman

    sudo yum -y install podman
    
  4. Use podman, e.g.

    podman run --rm -it registry.access.redhat.com/ubi8/ubi
    

Troubleshooting

Too many open files

containers/podman#5526 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment