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

@@ -18,9 +18,9 @@ while IFS="" read -u 3 -r SERVICE_PATH
do do
pushd "${SERVICE_PATH%/*}" pushd "${SERVICE_PATH%/*}"
pwd pwd
docker-compose pull || { fail_one "pull" ; continue ; } podman-compose pull || { fail_one "pull" ; continue ; }
docker-compose build --no-cache || { fail_one "build" ; continue ; } podman-compose build --no-cache || { fail_one "build" ; continue ; }
docker-compose up -d || { fail_one "switch to newly built container" ; continue ; } podman-compose up -d || { fail_one "switch to newly built container" ; continue ; }
popd popd
done 3< <( find . -iname "compose.yaml" ) done 3< <( find . -iname "compose.yaml" )

View File

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

View File

@@ -22,7 +22,7 @@ function is_user_conforming()
find $THD -not -user $TUN | grep . && { echo >&2 "Files not owned by user $TUN in $THD" ; return 6 ; } find $THD -not -user $TUN | grep . && { echo >&2 "Files not owned by user $TUN in $THD" ; return 6 ; }
id -nGz $TUN | grep -qzxF "docker" || { echo >&2 "User not in docker group" ; return 7 ; } # id -nGz $TUN | grep -qzxF "docker" || { echo >&2 "User not in docker group" ; return 7 ; } # not needed with podman
echo "All correct" echo "All correct"
return 0 return 0
@@ -38,7 +38,7 @@ then
fi fi
adduser --$ADDUSER_OPT "Dedicated user for gourichon infrastructure" --disabled-password --home $THD --gecos "" $TUN adduser --$ADDUSER_OPT "Dedicated user for gourichon infrastructure" --disabled-password --home $THD --gecos "" $TUN
adduser $TUN docker # adduser $TUN docker # not needed with podman
mkdir -p $THD/.ssh mkdir -p $THD/.ssh
chmod 700 $THD/.ssh chmod 700 $THD/.ssh