-
Notifications
You must be signed in to change notification settings - Fork 487
DL3003
FROM busybox
RUN cd /usr/src/app && git clone [email protected]:lukasmartinelli/hadolint.git FROM busybox
WORKDIR /usr/src/app
RUN git clone [email protected]:lukasmartinelli/hadolint.gitFROM busybox
RUN cd /usr/src/app && cp somedir/somefile ./someDirInUsrSrcApp/FROM busybox
RUN cp somedir/somefile /usr/src/app/someDirInUsrSrcApp/Only use cd in a subshell. Most commands can work with absolute paths and it in most cases not necessary
to change directories. Docker provides the WORKDIR instruction if you really need to change the current
working directory, but please mind its "side effects" (see below for more details).
When executed in a Subshell.
Please note that there may be side effects by the last WORKDIR instruction, as this is also (a) the current
working directory when the Docker container is finally started, or (b) the working directory for any RUN,
CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile (see Dockerfile WORKDIR
documentation). Moreover using cd in a RUN
instruction also the advantage of being free of side effects afterwards: that is, it only affects this single
RUN instruction, but not any subsequent instructions.