November 2018
Beginner
230 pages
6h 4m
English
We have seen the WORKDIR instruction used in some of the examples used to demonstrate other instructions. It is sort of like a combination of the Linux cd and mkdir commands. The WORKDIR instruction will change the current working directory in the image to the value provided in the instruction. If any segment of the path in the parameter of the WORKDIR instruction does not yet exist, it will be created as part of the execution of the instruction. The syntax for the WORKDIR instruction is as follows:
# WORKDIR instruction syntaxWORKDIR instruction syntaxWORKDIR /path/to/workdir
The WORKDIR instruction can use ENV or ARG parameter values for all or part of its parameter. A Dockerfile can have more than one WORKDIR instruction, ...
Read now
Unlock full access