scratchEstimated reading time: 1 minute
an explicitly empty image, especially for building images “FROM scratch”
This image is most useful in the context of building base images (such as
busybox) or super minimal images (that contain only a single binary and whatever it requires, such as
As of Docker 1.5.0 (specifically,
FROM scratch is a no-op in the
Dockerfile, and will not create an extra layer in your image (so a previously 2-layer image will be a 1-layer image instead).
You can use Docker’s reserved, minimal image,
scratch, as a starting point for building containers. Using the
scratch“image” signals to the build process that you want the next command in the
Dockerfileto be the first filesystem layer in your image.
scratchappears in Docker’s repository on the hub, you can’t pull it, run it, or tag any image with the name
scratch. Instead, you can refer to it in your
Dockerfile. For example, to create a minimal container using
library, sample, scratch
FROM scratch COPY hello / CMD ["/hello"]