packaging: Fix kata-deploy-binaries-in-docker.sh with podman

Instad of bailing out whenever the docker group doesn't exist, just
consider podman is being used, and set the docker_gid to the user's gid.

Also, let's ensure to pass `--privileged` to the container, so
`/run/podman/podman.socket` (which is what `/var/run/docker.sock` points
to) can be passed to the container.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2022-10-17 17:16:43 +02:00
parent 07e76c7392
commit 411888796b

View File

@ -23,7 +23,7 @@ fi
# This is the gid of the "docker" group on host. In case of docker in docker builds # This is the gid of the "docker" group on host. In case of docker in docker builds
# for some of the targets (clh builds from source), the nested container user needs to # for some of the targets (clh builds from source), the nested container user needs to
# be part of this group. # be part of this group.
docker_gid=$(getent group docker | cut -d: -f3 || { echo >&2 "Missing docker group, docker needs to be installed" && false; }) docker_gid=$(getent group docker | cut -d: -f3 || { echo >&2 "Missing docker group, probably podman is being used" && echo "${gid}"; })
# If docker gid is the effective group id of the user, do not pass it as # If docker gid is the effective group id of the user, do not pass it as
# an additional group. # an additional group.
@ -45,6 +45,7 @@ docker build -q -t build-kata-deploy \
"${script_dir}/dockerbuild/" "${script_dir}/dockerbuild/"
docker run \ docker run \
--privileged \
-v $HOME/.docker:/root/.docker \ -v $HOME/.docker:/root/.docker \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
--user ${uid}:${gid} \ --user ${uid}:${gid} \