Discover how starting from nothing can make your containers lightning fast and super secure!
Why Scratch base image for minimal containers in Docker? - Purpose & Use Cases
Imagine you want to create a tiny container for your app, but you start with a big, full operating system image that includes lots of tools and files you don't need.
This makes your container bulky and slow to download or start.
Using large base images wastes storage and bandwidth.
It also increases security risks because unnecessary software might have vulnerabilities.
Manually removing files is tedious and error-prone.
The Scratch base image is an empty container image with nothing inside.
You add only what your app needs, making the container as small and secure as possible.
FROM ubuntu:latest RUN apt-get update && apt-get install -y curl COPY app /app
FROM scratch COPY app /app
It enables creating ultra-light, secure containers that start fast and use minimal resources.
Deploying a simple Go app as a container using Scratch results in a tiny image under 10MB, perfect for fast cloud deployments.
Large base images slow down containers and increase risks.
Scratch image starts empty, so you add only what you need.
Results in smaller, faster, and safer containers.