docker_practice/image/dockerfile/workdir.md

37 lines
1.7 KiB
Go
Raw Normal View History

# WORKDIR
`WORKDIR <工作目录路径>`
使 `WORKDIR` `WORKDIR`
`Dockerfile` Shell
2017-11-23 15:48:52 +00:00
```docker
RUN cd /app
RUN echo "hello" > world.txt
```
2017-11-23 15:48:52 +00:00
`Dockerfile` `/app/world.txt` `hello` Shell `Dockerfile` `RUN` `Dockerfile`
`RUN` `RUN cd /app`
使 `WORKDIR`
```docker
WORKDIR /app
RUN echo "hello" > world.txt
```
`WORKDIR` 使 `WORKDIR`
```docker
WORKDIR /a
WORKDIR b
WORKDIR c
RUN pwd
```
`pwd` `/a/b/c`