In docker I want to do this:
git clone XYZ cd XYZ make XYZ
However because there is no cd command, I have to pass in the full path everytime (make XYZ /fullpath). Any good solutions for this?
Just use the WORKDIR command to change the directory you want to. Any other commands you use beyond this command will be executed in the directory you have set. It is also a better practice to make use of WORKDIR in docker.
No. WORKDIR affects the working directory inside the container. In the original example, the first COPY copies from package.
to find the root directory of docker. You will find the docker directory will be given in this line: "Docker Root Dir: /var/lib/docker". The docker images, they are stored inside the docker directory: /var/lib/docker/ images are stored there.
By default, Docker stores most of its data inside the /var/lib/docker directory on Linux systems.
To change into another directory use WORKDIR. All the RUN, CMD and ENTRYPOINT commands after WORKDIR will be executed from that directory.
RUN git clone XYZ WORKDIR "/XYZ" RUN make
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With