workdir-absolute
What it does
Section titled “What it does”Reports a WORKDIR with a relative path. A path is absolute when it starts with /, a drive letter (C:) or a variable ($HOME, ${DIR}/x). Quotes around the path make no difference, and a relative path is reported also after an absolute WORKDIR.
Why it matters
Section titled “Why it matters”A relative WORKDIR is resolved against the previous WORKDIR, or against the one of the base image, which you may not control. Adding an instruction or changing the base image then moves the directory without any sign in this line. An absolute path always means the same place.
Example
Section titled “Example”...FROM alpine:3@sha256:abcWORKDIR appWORKDIR /appWORKDIR $HOME...Configuration
Section titled “Configuration”dockerfile: lint: rules: workdir-absolute: warn # off (default), warn, errorEnabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line workdir-absolute in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| hadolint | DL3000 |
full |