Skip to main content

DL3000: Use absolute WORKDIR

Error Maintainability

Why This Matters

Relative WORKDIR paths depend on the previous WORKDIR value, making the Dockerfile harder to understand and maintain. If the base image changes its default working directory, a relative WORKDIR can suddenly resolve to a completely different location. Use absolute paths to make the build deterministic and self-documenting.

How to Fix

Use an absolute path for WORKDIR

Before (incorrect)

WORKDIR app

After (correct)

WORKDIR /app

Rule Details

Rule Code
DL3000
Severity
Error
Category
Maintainability

Related Rules