Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions podman/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,9 @@ RUN mkdir -p /var/lib/shared/overlay-images \
touch /var/lib/shared/vfs-images/images.lock && \
touch /var/lib/shared/vfs-layers/layers.lock

# Rootless helper scripts
COPY podman-rootless /usr/local/bin/
COPY run-as-podman /usr/local/bin/

ENV _CONTAINERS_USERNS_CONFIGURED="" \
BUILDAH_ISOLATION=chroot
11 changes: 11 additions & 0 deletions podman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ the fuse kernel module has not been loaded on your host system. Use the command
module and then run the container image. To enable this automatically at boot time, you can add a configuration
file to `/etc/modules.load.d`. See `man modules-load.d` for more details.

## Sample Usage Rootless Podman running Rootless Podman
If you set up [rootless podman](https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md)
on your system, and you want to run
[Rootless Podman running Rootless Podman](#blog-post-with-details)
then you have to run the podman CLI with user podman to correctly map user and group id.
However, in special environments (e.g. in CI environments) it's sometimes helpful to run the inner container as root
user to install packages, prepare the build etc.
To run the podman CLI in the inner container with user podman use
`podman-rootless <podman-cmd>`.
If you need to to run an arbitrary command with user podman use `run-as-podman <shell-command>`.

### Blog Post with Details

Dan Walsh wrote a blog post on the [Enable Sysadmin](https://www.redhat.com/sysadmin/) site titled [How to use Podman inside of a container](https://www.redhat.com/sysadmin/podman-inside-container). In it, he details how to use these images as a rootful and as a rootless user. Please refer to this blog for more detailed information.
2 changes: 2 additions & 0 deletions podman/podman-rootless
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
runuser -u podman -- podman "$@"
2 changes: 2 additions & 0 deletions podman/run-as-podman
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
runuser -u podman -- "$@"