Edit file on kubernetes image before starting it

4/2/2020

I have an image called http which has a file called httpd-isec.conf. I'd like to edit httpd-isec.conf before the image is started by kubernetes. Is that possible?

Would initContainers and mounting the image work in some way?

-- Vladimir
edit
kubernetes

2 Answers

4/2/2020

Yes please add a boot script in your image to edit the file . You could also create a custom image and put you http image as base image for it and edit the file on init

-- priyanshu kumar
Source: StackOverflow

4/2/2020

This is not possible. Images are immutable. What you can do is use an init container to copy the file to an emptyDir volume, edit it, and then mount that volume over the original file in the main container.

-- coderanger
Source: StackOverflow