Docker Concepts

scratch base

An empty starting filesystem. Supply executable and any required libraries, data, certificates or other runtime assets explicitly. No default shell. No default shell or user hardening is supplied; inspect executable dependencies.

Formal Syntax & Structure

docker syntaxdocker
FROM scratch

Working Example

Example Snippetdocker
FROM golang:1.26 AS compileWORKDIR /srcCOPY main.go .RUN mkdir /out && CGO_ENABLED=0 GO111MODULE=off go build -trimpath -o /out/greeting main.goFROM scratchCOPY --from=compile /out/greeting /greetingCMD ["/greeting"]
Docker Reference