There are two things happening here.
A Dockerfile that starts FROM scratch
starts from a base image that has absolutely nothing at all in it. It is totally empty. There is not a set of base tools or libraries or anything else, beyond a couple of device files Docker pushes in for you.
The ENTRYPOINT echo ...
command gets rewritten by Docker into ENTRYPOINT ["/bin/sh", "-c", "echo ..."]
, and causes the CMD
to be totally ignored. Unless overridden with docker run --entrypoint
, this becomes the main process the container runs.
Since it is a FROM scratch
image and contains absolutely nothing at all, it doesn't contain a shell, hence the "/bin/sh: no such file or directory" error.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…