Skip to content

No variable interpolation in label name #708

@benzht

Description

@benzht

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions