Missing Zypper Clean

  • Query id: 38300d1a-feb2-4a48-936a-d1ef1cd24313
  • Query name: Missing Zypper Clean
  • Platform: Dockerfile
  • Severity: Medium
  • Category: Supply-Chain
  • URL: Github

Description

Reduce layer and image size by deleting unneeded caches after running zypper
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - dockerfile file
FROM busybox:1.0
RUN zypper install
HEALTHCHECK CMD curl --fail http://localhost:3000 || exit 1

Code samples without security vulnerabilities

Negative test num. 1 - dockerfile file
FROM busybox:1.0
RUN zypper install -y httpd=2.4 && zypper clean
HEALTHCHECK CMD curl --fail http://localhost:3000 || exit 1