Reputation: 708
I have 3 ENV Variables, that somehow are dependent on each other.
I found both syntaxes below to be not working and I am not able to find correct sytax also, Can someone please help me ?
ENV_1=/path/
ENV_2="$ENV_1"/dir2
ENV_3="$ENV_2"/dir3
ENV_1=/path/
ENV_2=$ENV_1/dir2
ENV_3=$ENV_2/dir3
Upvotes: 2
Views: 2016
Reputation: 4328
Environment variables are declared with the ENV
statement in Dockerfiles.
You can try the following approach
Dockerfile:
FROM alpine
ENV parent=parent_dir
ENV child=child_dir
WORKDIR /tmp
#create nested dir structure in /tmp
RUN mkdir -p $parent\/$child
After you build the image and start the container , you will have the following structure inside the container:
/ # tree /tmp/
/tmp/
└── parent_dir
└── child_dir
Upvotes: 1