Docker

Docker

Made by DeepSource

Use absolute WORKDIR DOK-DL3000

Bug risk
Minor

By using absolute paths you will not run into problems when a previous WORKDIR instruction changes. You also often don't know the WORKDIR context of your base container.

Bad Practice

FROM debian:buster
WORKDIR usr/src/app

Recommended

FROM debian:buster
WORKDIR /usr/src/app

Exceptions

When using environment replacements, absolute paths aren't required.

FROM debian:buster
ENV foo /bar
WORKDIR ${foo}   # WORKDIR /bar