Dockerfileで使用するWORKDIR
命令。独自の名前のディレクトリを使用したい場合、RUN
命令でフォルダの作成は不要。
ドキュメントより抜粋、翻訳
If the WORKDIR doesn’t exist, it will be created even if it’s not used in any subsequent Dockerfile instruction.
(翻訳)WORKDIRが存在しない場合は、その後のDockerfile命令で使用されなくても作成されます。
WORKDIRのテスト
$ cat << EOF > Containerfile FROM registry.access.redhat.com/ubi8-micro ENV APP_ROOT /test WORKDIR \${APP_ROOT} CMD ["pwd"] EOF $ buildah bud -t test . $ podman run --rm test /test