Use podman instead of docker.

This commit is contained in:
Stephane Gourichon
2025-08-15 17:40:10 +02:00
parent 4076de240c
commit 2b445b9457
3 changed files with 12 additions and 12 deletions

View File

@@ -24,7 +24,7 @@ CONTAINER_IDS=( "$@" )
if [[ "${#CONTAINER_IDS[@]}" == 0 ]]
then
echo "No container ID supplied on command line, doing them all."
mapfile -t CONTAINER_IDS < <( docker ps --format "{{.ID}}" )
mapfile -t CONTAINER_IDS < <( podman ps --format "{{.ID}}" )
fi
RC=0
@@ -36,7 +36,7 @@ for CONTAINER_ID in "${CONTAINER_IDS[@]}"
do
echo "Processing $CONTAINER_ID"
TMPFILE=$(mktemp)
docker exec -u root $CONTAINER_ID bash -c "export LC_ALL=C ; apt-get update ; apt-get upgrade -y --dry-run" | tee $TMPFILE
podman exec -u root $CONTAINER_ID bash -c "export LC_ALL=C ; apt-get update ; apt-get upgrade -y --dry-run" | tee $TMPFILE
trap "rm $TMPFILE" EXIT
if grep "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." $TMPFILE
then
@@ -44,13 +44,13 @@ do
continue
fi
PATH_OF_CONTAINER="$( docker inspect --format='{{ index .Config.Labels "com.docker.compose.project.working_dir" }}' $CONTAINER_ID )"
NAME_OF_CONTAINER="$( docker inspect --format='{{ .Name }}' $CONTAINER_ID )"
PATH_OF_CONTAINER="$( podman inspect --format='{{ index .Config.Labels "com.docker.compose.project.working_dir" }}' $CONTAINER_ID )"
NAME_OF_CONTAINER="$( podman inspect --format='{{ .Name }}' $CONTAINER_ID )"
echo "IMPORTANT: building a new, up-to-date, container $NAME_OF_CONTAINER from $PATH_OF_CONTAINER"
cd $PATH_OF_CONTAINER
docker-compose --no-ansi pull || { fail_one "pull" ; continue ; }
docker-compose --no-ansi build --no-cache || { fail_one "build" ; continue ; }
docker-compose --no-ansi up -d || { fail_one "switch to newly built container" ; continue ; }
podman-compose --no-ansi pull || { fail_one "pull" ; continue ; }
podman-compose --no-ansi build --no-cache || { fail_one "build" ; continue ; }
podman-compose --no-ansi up -d || { fail_one "switch to newly built container" ; continue ; }
done