Perform the following steps to create a smaller image using the scratch base image:
- Change to the repository directory:
$ cd scratch
- Now, build a static executable demo from the demo.c file using the gcc:7.2 runtime container, as shown in the following code:
$ docker container run --rm \ -v ${PWD}:/src \ -w /src \ gcc:7.2 \ gcc -static -o demo demo.c
- Having built the statically linked executable lets quickly verify the binary:
- Continue to build an image from the scratch base image with the executable demo created in the previous step, as shown in the following code:
- Finally, let us verify the image by spinning a ...