podman-compose icon indicating copy to clipboard operation
podman-compose copied to clipboard

No variable interpolation in label name

Open benzht opened this issue 2 years ago • 2 comments

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

benzht avatar Jun 11 '23 14:06 benzht

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

ngolatka avatar Sep 10 '24 10:09 ngolatka

We are also experiencing this issue on v1.4.0, podman 4.9.4-rhel.

awildturtok avatar Jun 05 '25 07:06 awildturtok

@benzht Thank you for opening an issue! It was fixed in #1258.

mokibit avatar Jun 30 '25 20:06 mokibit