ufk
ufk

Reputation: 32104

configure in Dockerfile a mount point and extract files to that mount point

I have a kubernetes cluster on google cloud platform.

I'm extending the official php docker image to support certbot and others.

this is what I have so far:

FROM php:7.1.13-apache-jessie

RUN bash -c 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list'
RUN apt-get update
RUN apt-get install -y python-certbot-apache -t jessie-backports

is there a way to configure what will happen when the pod is started ?

I want to check if the user mounted empty volumes for specific directories and if they are empty to fill them with the relevant content.

for example.. I want to store /etc/apache2 default configuration somewhere... so if the user mounted an empty volume to /etc/apache2, to fill it with the relevant file.

same for /var/www/html.

any ideas how to do so ?

thanks! :)

Upvotes: 1

Views: 87

Answers (1)

VonC
VonC

Reputation: 1324447

Is there a way to configure what will happen when the pod is started ?

That is what your ENTRPYPOINT/CMD can be for: you can have your own image with an ENTRYPOINT script which will:

That being said, copying dynamically stuff from the host is not a practice I have seen often (you don't know what the local host has), even though docker cp might do that.
Maybe stopping with a warning message is better.

Upvotes: 1

Related Questions