Reputation: 21
I have a Dockerfile containing some text that looks like '$MYVARIABLE' passed in as labels (these strings are used for custom tooling).
I'm noticing that once this Dockerfile is successfully built that a docker inspect
of the resultant image shows blank space where these '$MYVARIABLE' style strings are in the Dockerfile. I just want '$MYVARIABLE' passed as a literal string I don't want it treated as a variable at all.
My first guess was that my shell is trying to expand these as if they were regular variables even though I'm not using Dockerfile ARG or ENV syntax. I concluded this was not the case. So my question is where are these strings going?
Upvotes: 1
Views: 821
Reputation: 5482
You would need to declare the passed var as an ARG
in the dockerfile.
That is if you want to use the var MY_ARG
as Label , you would have to declare it in the following manner :
ARG MY_ARG
LABEL "My Arg"=$MY_ARG
If you are already doing that , maybe the issue is with how those variables are initialized/passed.Maybe some code will help.
Upvotes: 1