mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
utils/docker-run: set podman userns option in environment
Commit 9a629f5 "utils/docker-run: allow running with Podman" added an
option on system providing the podman command. This case is mainly
for Fedora systems.
Fedora repositories have a podman-docker package, that provides the
docker command for compatibility. See [1]. In that case, invoking
"docker" redirects to podman.
When this package is installed on a Fedora system, both the docker and
podman commands are available. Since the docker command is checked
before podman, the --userns option is not passed in that case. This
brings "permission denied" errors.
Other cases are also possible, like a host system providing the real
Docker alongside a podman installation. In such a case, to avoid
unexpected change of behavior of the docker-run script, the original
search order is preserved (search for "docker" first, then "podman").
This commit changes the way the podman user namespace mode is set.
Rather than adding the "--userns=keep-id" command line option only in
the podman case, it is globally set using the PODMAN_USERNS=keep-id
environment variable [2].
Doing so makes sure that the variable will be consumed by the "docker"
compatibility command, and just ignored by the real "docker"
implementation.
[1] https://packages.fedoraproject.org/pkgs/podman/podman-docker/
[2] https://docs.podman.io/en/latest/markdown/podman-run.1.html
Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
committed by
Yann E. MORIN
parent
42fad03182
commit
f97e6293de
@@ -29,11 +29,16 @@ declare -a mountpoints=(
|
||||
"$(pwd)"
|
||||
)
|
||||
|
||||
# We use the PODMAN_USERNS environment variable rather than using the
|
||||
# --userns command line argument because Fedora system may have the
|
||||
# podman-docker package installed, providing the "docker"
|
||||
# compatibility command.
|
||||
export PODMAN_USERNS="keep-id"
|
||||
|
||||
if command -v docker >/dev/null; then
|
||||
DOCKER="docker"
|
||||
elif command -v podman >/dev/null; then
|
||||
DOCKER="podman"
|
||||
docker_opts+=( --userns=keep-id )
|
||||
else
|
||||
echo "ERROR: Neither docker nor podman available!" >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user