About this question
I want to use these with docker:
git clone XYZ
cd XYZ
make XYZ
But I can't as the cd command is not there. I do not wish to make xyz as the full path everytime, are there any workarounds?
I want to use these with docker:
git clone XYZ
cd XYZ
make XYZ
But I can't as the cd command is not there. I do not wish to make xyz as the full path everytime, are there any workarounds?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Business Analyst Expert
Answered on May 26, 2021
Easy ! Just use the WORKDIR command to change the dockerfile change directory you want to. Any other commands you use beyond this command will be executed in the directory you have set.
Here's an example:
RUN git clone XYZ
WORKDIR "/XYZ"
RUN makeIt is also a better practice to make use of WORKDIR in docker.
OR
You can do this by using a much more complex RUN command, like given below:
RUN cd /opt && unzip treeio.zip && mv treeio-master treeio &&
rm -f treeio.zip && cd treeio && pip install -r requirements.pip
And this way it only gets to the last command [ pip install ] only if the previous commands were successfully executed.
Combining the different RUN commands is recommended. This is because every time a RUN command is executed an AUFS layer and a new commit are created and there is a limit for them, so be careful about them.
Hope that helped 
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Most-read guides across JanBask
Common Business Analyst interview questions, answered
Guides, tips and career advice on Business Analyst from JanBask experts.
Business Analyst Business Analyst Skills for Career Growth & Job Success
Learn the essential business analyst skills ranging from SQL, data analysis, and BI tools to communication, leadership, and…
Business Analyst Business Analyst Job Description 2025: Key Responsibilities
Explore a complete business analyst job description. Understand key roles, job responsibilities, skills required and start or…
Business Analyst What is a Business Analyst? Definition, Functions & Real-World Relevance
A Business Analyst is a key professional who analyzes business needs, identifies problems, and proposes effective solutions to…
Business Analyst Top 11 Business Analytics Tools to Know About In 2025
Some of the most popular business analytics tools used by business analytics professionals are Blueprint, Case Spec, Axure, Bit…