Pattern: Use of cd
in Dockerfile
Issue: -
Most commands can work with absolute paths without changing directories. Docker provides the WORKDIR
instruction if you really need to change the current
working directory.
Example of incorrect code:
RUN cd /usr/src/app && git clone git@github.com:lukasmartinelli/hadolint.git
Example of correct code:
RUN git clone git@github.com:lukasmartinelli/hadolint.git /usr/src/app
When executed in a Subshell.