Reputation: 107
Is there a way to do variable/file transforms in the *.config file of a docker image as it's deployed (to a Kubernetes cluster - AKS)?
This could be done by doing the replacement and creating a docker container image for each configuration but this would lead to a lot of extra container images when the only difference is the configuration file.
Upvotes: 0
Views: 581
Reputation: 9590
A Docker image is build as a readable/writeable layer on top of a bunch of read-only layers. These layers (also called intermediate images) are generated when the commands in the Dockerfile
are executed during the Docker image build.
These intermediate layers are shared across the Docker image to help increase reusability, decrease disk usage, and speed up docker build
by allowing each step to be cached.
So, if you create multiple images by changing the configuration setting, each image use the shared layers that are unchanged and only the changed configuration amounts to the extra size for the new images.
Alternately, you could define these configurations as ConfigMap
if you use Kubernetes and mount them on the pod as volumes/environment variables.
Upvotes: 1