the binary is put in the current directory because of the volume mapping
-v $PWD:/build
build the hello image (build uses the binary built in step 1, ADD hello /)
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 Dockerfile to be the first filesystem layer in your image.
While scratch appears 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 scratch:
create a Dockerfile like this
FROM scratch
ADD hello /
CMD ["/hello"]
Assuming you built the “hello” executable example from the Docker GitHub example C-source code, and you compiled it with the -static flag, you can then build this Docker image using:
docker build --tag hello .
THEN you can run it
Then you can run it (on Linux, Mac, or Windows) using: