Skip to content

hadolint/DL3000

Use absolute WORKDIR.

Superseded by buildkit/WorkdirRelativePath, which provides the same check with improved diagnostics.

Description

Using a relative WORKDIR without first setting an absolute path can lead to unexpected results if the base image changes its working directory.

Examples

Problematic code

FROM nginx
WORKDIR usr/share/nginx/html

Correct code

FROM nginx
WORKDIR /usr/share/nginx/html

Reference