I have a Dockerfile that contains two WORKDIR statements (amid other ones) like so:
RUN pwd # reports /root
WORKDIR /tmp
RUN wget ...
RUN tar zxvf ...
RUN cd ... && ; ./configure && make && make install
RUN sed ...
RUN sed ...
RUN rm ...
RUN rm -fr ...
WORKDIR $HOME
RUN pwd # reports /tmp (instead of /root)
I would expect pwd to be /root (i.e. $HOME for root) afterwards, but it remains at /tmp. Am I making an obvious mistake here? Is there a better way for restoring pwd to its "original" value.