Skip to content

How docker build turns a Dockerfile into layers

Select an icon to see what it is.

Step 5 of 6

CMD changes only metadata

CMD does not run anything during the build and adds no layer. It sets the Cmd field in the image config. The image config also records Env, WorkingDir and the list of layers, and the image gets its Id from a hash of that config.

docker image inspect web:1.0 (excerpt)

{
"Config": {
"Cmd": [
"/app.sh"
]
}
"RootFS": {
"Type": "layers"
"Layers": [
"sha256:<alpine>"
"sha256:<copy>"
"sha256:<run>"
]
}
}