Change directory command in Docker?

后端 未结 3 1996
我在风中等你
我在风中等你 2020-12-04 10:23

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 everytim

3条回答
  •  情歌与酒
    2020-12-04 10:40

    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
    

提交回复
热议问题