This builds a Docker image of a minimal Alpine Linux distribution from scratch.
Why would I do this instead of just using the official Alpine Docker image? I wanted to learn how to create an image from scratch that wasn't one of the really simple examples of "write your own statically linked executable and put that in the container". I was looking for something that ended up looking more like a linux distribution that I could then use as the FROM
to build an application like Apache.
The overall process is pretty simple.
- Using the Make Alpine Linux RootFS script create a RootFS configured with your desired packages and create a non-root user.
- Create a
Dockerfile
- Build image.
The main script is build.sh
.
The post-install.sh
script is used during the build process to update packages and add a non-root user.
I need to give credit to Dave Hall where I found the basis for this code. I've modified it to meet my needs.