on Host: podman exec <container-name> echo $VAR1 no output

Posted on

Hello.
Related to containers and setting environment variables for them, I podman run -d a UBI image with -e VAR1="lab1" and -e VAR2="lab2". When I podman exec echo $VAR1 (echo $VAR2) from the host, I get no output. If I podman attach to the container and I run inside the container echo $VAR1 and echo VAR2 I get lab1 and lab2, respectively. Photo attached. Would you know why when I podman exec echo $VAR1 from the host, there is no output (that is lab1)?
Other variables like USER, PATH show the right output:
[user1@rhcsa6 ~]$ podman exec 789401760acc echo $USER
user1
[user1@rhcsa6 ~]$ podman exec 789401760acc echo $PATH
/home/user1/.local/bin:/home/user1/bin:/home/user1/.local/bin:/home/user1/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
Thank you.

Responses