Interesting, tested with
COMPOSE_FILENAME=joomla01
in global environment variables.
version: "3.8"
services:
"${COMPOSE_FILENAME}":
hostname: "${COMPOSE_FILENAME}"
image: "joomla:5"
container_name: "${COMPOSE_FILENAME}"
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ}
- "JOOMLA_DB_HOST=${DB_HOST}"
- "JOOMLA_DB_NAME=${COMPOSE_FILENAME}"
At first glance by checking: all substitutions work properly except services Additional property ${COMPOSE_FILENAME} is not allowed on the services tag.
But I guess the answer is clear: What I would like is not currently possible. It would require pre-processing the compose file before handing it to over to docker.
Thanks for your help and giving me insights.