Is it possible to show the `WORKDIR` when building a docker image?

There’s no builtin way for Docker to print the WORKDIR during a build. You can inspect the final workdir for an image/layer via the .Config.WorkingDir property in the inspect output:

docker image inspect -f '{{.Config.WorkingDir}}' {image-name}

It’s possible to view a Linux containers build steps workdir by printing the shells default working directory:

RUN pwd

or the shell often stores the working directory in the PWD environment variable

RUN echo "$PWD"

If you are using newer versions of docker with BuildKit, stdout will need to be enabled with --progress=plain

docker build --progress=plain . 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)