utils/docker-run: allow running with Podman
Podman is command line compatible with Docker, there's no need to require contributors to install Docker to run checks before sending patches. The additional "--userns=keep-id" option is necessary because unlike Docker Podman creates a user namespace for containers by default. Without keep-id the repository and pre-existing output files belong to root inside the container namespace, breaking writes, certain Git safety checks, and possibly all access (if the user is using a strict umask). Signed-off-by: Fiona Klute <fiona.klute+wiwa@gmx.de> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
committed by
Yann E. MORIN
parent
b574b0b9e6
commit
9a629f5129
@@ -29,6 +29,16 @@ declare -a mountpoints=(
|
|||||||
"$(pwd)"
|
"$(pwd)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
# curl lists (and recognises and uses) other types of *_proxy variables,
|
# curl lists (and recognises and uses) other types of *_proxy variables,
|
||||||
# but only those make sense for Buildroot:
|
# but only those make sense for Buildroot:
|
||||||
for env in all_proxy http_proxy https_proxy ftp_proxy no_proxy; do
|
for env in all_proxy http_proxy https_proxy ftp_proxy no_proxy; do
|
||||||
@@ -84,4 +94,4 @@ if tty -s; then
|
|||||||
docker_opts+=( -t )
|
docker_opts+=( -t )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec docker run "${docker_opts[@]}" "${IMAGE}" "${@}"
|
exec ${DOCKER} run "${docker_opts[@]}" "${IMAGE}" "${@}"
|
||||||
|
|||||||
Reference in New Issue
Block a user