4.7 Ensure update instructions are not used alone in Dockerfiles

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

You should not use OS package manager update instructions such as apt-get update or yum update either alone or in a single line in any Dockerfiles used to generate images under review.

Rationale:

Adding update instructions in a single line on the Dockerfile will cause the update layer to be cached. When you then build any image later using the same instruction, this will cause the previously cached update layer to be used, potentially preventing any fresh updates from being applied to later builds.

Impact:

None

NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance.

Solution

You should use update instructions together with install instructions and version pinning for packages while installing them. This will prevent caching and force the extraction of the required versions.
Alternatively, you could use the --no-cache flag during the docker build process to avoid using cached layers.

Default Value:

By default, Docker does not enforce any restrictions on using update instructions.

See Also

https://workbench.cisecurity.org/files/4244