Vladimir
Vladimir

Reputation: 425

Edit file on kubernetes image before starting it

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?

Upvotes: 0

Views: 1496

Answers (2)

priyanshu kumar
priyanshu kumar

Reputation: 76

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

Upvotes: 0

coderanger
coderanger

Reputation: 54247

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.

Upvotes: 1

Related Questions