Contents

Docker Minimize Base Image

Base and Parent Image

TypeDescription
Base ImageA base image has FROM scratch in its Dockerfile.
Parent ImageA parent image is the image that your image is based on. It refers to the contents of the FROM directive in the Dockerfile.

Base Image Choose Rules

Authenticity

Authenticity
Check OFFICIAL IMAGE on docker hub.

Up-to-date

Up-to-date
Check update time on docker hub.

Slim and Minimal Image

  • Only install necessary packages
    • Remove Shells, Package Managers, Tools
  • Maintain images for each environment
    • Development - Including debug tools
    • Production - Lean
  • Use multi-stage builds to create lean production ready images

Distroless Docker Images

  • Contains
    • Application
    • Runtime Dependencies
  • Not Contains
    • Package Managers
    • Shells
    • Network Tools
    • Text Editors
    • etc

Vulnerability Scanning

1
trivy image httpd
1
trivy image httpd:alpine