Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runlabel: support for env vars in label #2171

Closed
dustymabe opened this issue Jan 16, 2019 · 5 comments
Closed

runlabel: support for env vars in label #2171

dustymabe opened this issue Jan 16, 2019 · 5 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@dustymabe
Copy link
Contributor

/kind feature

Description

Is podman container runlabel supposed to support env var substitution? I can't seem to get it to work.

For example: LABEL RUN="podman run -it -v \${PWD}/logs/:/home/user/.weechat/logs/:z --name weechat weechat" in my Dockerfile isn't working. The var gets replaced with an empty value.

This used to work in the past: For example: https://github.com/projectatomic/atomicapp/blob/fba5cbb0a42b79418ac85ab93036a4404b92a431/Dockerfile#L7-L11

Additional information you deem important (e.g. issue happens only occasionally):

  • i'm running in rootless mode

Output of podman version:

  • podman-0.12.1.2-1.git9551f6b.fc29.x86_64
@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 16, 2019
@rhatdan
Copy link
Member

rhatdan commented Jan 16, 2019

Yes this is supposed to work.

@rhatdan
Copy link
Member

rhatdan commented Mar 8, 2019

@baude has this been fixed.

baude added a commit to baude/podman that referenced this issue Mar 8, 2019
When doing environment variable substitution, we need to make sure
$PWD is replaced with the current working directory.

fixes issue containers#2171

Signed-off-by: baude <bbaude@redhat.com>
@ghost
Copy link

ghost commented Mar 10, 2019

Another variable to substitute is $UID. For example, when I use LABEL run="podman run --rm --interactive --tty --network=none --uidmap 0:1:\$UID --uidmap \$UID:0:1 --volume \"\$PWD\":/export/ \$IMAGE" in a Dockerfile, and use podman container runlabel run, \$IMAGE is replaced correctly, but \$UID gets replaced by nothing and podman complains that the mapping is invalid.

@garyedwards
Copy link

garyedwards commented Mar 29, 2019

Hi, another variable to substitute would be $DISPLAY. I get the same behaviour described above:

sudo podman inspect localhost/ros:xenial-kinetic-testing | grep RUN
"RUN": "podman run --rm --interactive --network host --tty --env DISPLAY=$DISPLAY IMAGE"

sudo podman container runlabel run --display ros:xenial-kinetic-testing
Command: /proc/self/exe run --rm --interactive --network host --tty --env DISPLAY= localhost/ros:xenial-kinetic-testing

There must be many situations where variable need substituting, is there a more generic way this can be dealt with? Other example variables can be found in the fedora toolbox project:

https://github.com/debarshiray/toolbox/blob/master/toolbox#L24

muayyad-alsadi pushed a commit to muayyad-alsadi/libpod that referenced this issue Apr 21, 2019
When doing environment variable substitution, we need to make sure
$PWD is replaced with the current working directory.

fixes issue containers#2171

Signed-off-by: baude <bbaude@redhat.com>
@baude
Copy link
Member

baude commented Aug 2, 2019

supposed to be fixed, reopen if needed

@baude baude closed this as completed Aug 2, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

5 participants