I have a variable in a script called image_name
image_name="my-app"
And I'm trying to pass this variable to a docker container, as shown below:
docker build -t $image_name .
docker run --rm --name $image_name -e "app_dir=${image_name}" $image_name
But this variable is not set and is empty in the context of the docker assembly
This is a snippet from the Docker file below:
....
RUN echo dir is $app_dir
....
The following is a snippet of assembly output:
....
Step 2 : RUN echo dir is $app_dir
---> Running in db93a939d701
dir is
---> c9f5e2a657d5
Removing intermediate container db93a939d701
....
Does anyone know how to make variable substitution?
source
share