No variable interpolation in label name
Describe the bug
Variable interpolation from .env file is not happening everywhere where expected. In the following excerpt for labels for a traefik frontend, the env-variable PROJECT_NAME is interpolated only at the right of the = character, but not on the left
labels:
- "traefik.http.routers.${PROJECT_NAME}_VB_secure.rule=Host(`${HOST_NAME}`)"
- testThis.${PROJECT_NAME}=${PROJECT_NAME}
With
PROJECT_NAME=testproject
HOST_NAME=www.example.com
The actually resulting labels look like this:
"--label",
"testThis.${PROJECT_NAME}=testproject",
"--label",
"traefik.http.routers.${PROJECT_NAME}_VB_secure.rule=Host(`www.example.com`)",
Expected outcome would be:
"--label",
"testThis.testproject=testproject",
"--label",
"traefik.http.routers.testproject_VB_secure.rule=Host(`www.example.com`)",
To Reproduce
Take any podman-compose file you have available, add the labels like show above, and define the variables in your .env file. Start the container and observe the generated podman command or inspect the created container.
Environment:
- OS:
Ubuntu 22.04.2 LTS - podman version:
$ podman version
Version: 3.4.4
API Version: 3.4.4
Go Version: go1.17.3
Built: Thu Jan 1 00:00:00 1970
OS/Arch: linux/amd64
- podman compose version:
$ podman-compose version
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 3.4.4
podman-compose version 1.0.6
podman --version
podman version 3.4.4
exit code: 0
Can confirm this exact problem.
podman version
Client: Podman Engine
Version: 4.9.4-rhel
API Version: 4.9.4-rhel
Go Version: go1.21.11 (Red Hat 1.21.11-1.el9_4)
Built: Mon Jul 1 12:27:14 2024
OS/Arch: linux/amd64
podman-compose version: 1.0.6
We are also experiencing this issue on v1.4.0, podman 4.9.4-rhel.
@benzht Thank you for opening an issue! It was fixed in #1258.