Skip to content
Lukas Martinelli edited this page Jan 11, 2016 · 2 revisions

Use WORKDIR to switch to a directory.

Problematic code:

FROM busybox
RUN cd /usr/src/app && git clone 

Correct code:

FROM busybox
RUN git clone /usr/src/app


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.


When executed in a Subshell.

You can’t perform that action at this time.