在 Dockerfile 中配置一个挂载点并将文件提取到该挂载点

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

我在google云平台上有一个kubernetes集群。

我正在扩展官方 php docker 图像以支持 certbot 和其他图像。

这是我目前拥有的:

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

有没有办法配置 pod 启动时会发生什么?

我想检查用户是否为特定目录安装了空卷,以及它们是否为空以填充相关内容。

例如..我想在某处存储/etc/apache2默认配置...所以如果用户将空卷安装到/etc/apache2,用相关文件填充它。

/var/www/html 相同。

有什么想法吗?

谢谢! :)

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

这就是您的 ENTRPYPOINT/CMD 的用途:您可以使用 ENTRYPOINT 脚本创建自己的图像,该脚本将:

也就是说,从主机动态复制内容并不是我经常看到的做法(您不知道本地主机有什么),尽管 docker cp 可能会这样做。
也许以警告消息停止更好。