Skip to main content

require_workdir

Function require_workdir 

Source
pub fn require_workdir(
    base: &BaseImage,
    dockerfile: Option<&str>,
) -> Result<(), Error>
Expand description

Rejects working-directory inheritance when nothing declares one.

Measured 2026-08-05: al2023-minimal, python:3.12-slim, and node:20-slim all leave WorkingDir empty, so “inherit the image WORKDIR” inherits / and every relative path in the caller’s commands resolves somewhere they did not mean.

Rejected rather than warned because the symptom appears in the guest, one build cycle later, as commands running in the wrong directory rather than as anything about WORKDIR.