Docker WORKDIR values are not absolute paths
Description
This rule detects whether all WORKDIR values specified in Dockerfiles are absolute paths. Absolute paths prevent ambiguity, ensure correct directory navigate to the intended directory structure, and contribute to predictable behavior during image build and runtime. Therefore, we recommend always using absolute paths for WORKDIR instruction in Dockerfiles.
Code Example
dockerfile
- WORKDIR relative/path
+ WORKDIR /absolute/pathRemediation
Docker
To mitigate this issue, ensure that all WORKDIR instructions in your Dockerfile use absolute paths.
Example:
Rule Details
| Field | Value |
|---|---|
| ID | IAC-0843 |
| Severity | LOW |
| IaC Type | dockerfile |
| Frameworks | Docker |
| Checkov ID | CKV_DOCKER_10 |