Update test-setup-docker for rootless podman

Some people are obsessed. But by some people I mean me, and by
obsessed I mean it's just how my machine is setup, so I kind of
have to make it work.

There's a couple of things here. First is just fully qualifying
the container image names because I don't have anything configured
for shortnames. That shouldn't mess with docker users.

Similarly, user=0 for mysql and postgres should be a docker no-op,
it's what they're doing already, but when I put in user-ns=keep
it's needed so they can do their normal rooty stuff on startup.

The most invasive change is the parameterization of the options to
the tmpfs mounts for zookeeper. The uid= option hard-fails for me
while I need to give it the U flag. Easier to pass more of the
option in the variable.

Change-Id: I1735cb2a4c113069782e8bc42b40621437760b15
This commit is contained in:
Monty Taylor committed 2026-09-25 23:08:39 +00:00
1 parent 8178e6189e
commit 578369d443
2 files changed
+15 -6

No files matched your search

+7 -5
View File
@@ -3,8 +3,9 @@ version: "3"
services:
mysql:
container_name: zuul-test-mariadb
user: "0"
# Roughly matches version in Ubuntu Noble
image: mariadb:10.11
image: docker.io/library/mariadb:10.11
environment:
- MYSQL_ROOT_PASSWORD=insecure_worker
ports:
@@ -16,7 +17,8 @@ services:
postgres:
container_name: zuul-test-postgres
image: postgres:latest
user: "0"
image: docker.io/library/postgres:latest
environment:
- POSTGRES_USER=openstack_citest
- POSTGRES_PASSWORD=openstack_citest
@@ -28,15 +30,15 @@ services:
zookeeper:
container_name: zuul-test-zookeeper
user: "${USER_ID}"
image: zookeeper
image: docker.io/library/zookeeper
environment:
- ZOO_AUTOPURGE_PURGEINTERVAL=1
- ZOO_LOG4J_PROP=WARN
ports:
- "2281:2281"
tmpfs:
- /data:uid=${USER_ID}
- /datalog:uid=${USER_ID}
- /data:${ZUUL_TMPFS_OPTIONS}
- /datalog:${ZUUL_TMPFS_OPTIONS}
volumes:
- "./ca:/var/certs:z"
- "./zoo.cfg:/conf/zoo.cfg:z"
+8 -1
View File
@@ -55,7 +55,14 @@ CA_DIR=$SCRIPT_DIR/ca
mkdir -p $CA_DIR
$SCRIPT_DIR/zk-ca.sh $CA_DIR zuul-test-zookeeper
${ROOTCMD} USER_ID=$(id -u) ${COMPOSE} up -d
# Per-container user namespaces require containers outside a shared pod.
export USER_ID=$(id -u)
if [ "${COMPOSE}" == "podman-compose" ]; then
${ROOTCMD} ZUUL_TMPFS_OPTIONS="U,mode=0700" ${COMPOSE} \
--pod-args='--infra=true --share= --userns=keep-id' up -d
else
${ROOTCMD} ZUUL_TMPFS_OPTIONS="uid=${USER_ID}" ${COMPOSE} up -d
fi
echo "Waiting for mysql"
timeout 30 bash -c "until ${ROOTCMD} ${MYSQL} -e 'show databases'; do sleep 0.5; done"