简体   繁体   English

将一个文件从ConfigMap挂载到emptyDir挂载点

[英]Mount one file from ConfigMap into the emptyDir mountpoint

I have the following mounPaths: 我有以下mounPaths:

volumeMounts:
        - mountPath: /var/opt/gitlab/gitaly
          name: gitaly
        - mountPath: /var/opt/gitlab/git-data
          name: git-data
          readOnly: true
        - mountPath: /var/opt/gitlab/git-data2
          name: git-data2
          readOnly: true
        - mountPath: /var/opt/gitlab/gitaly/
          name: config
          subPath: config.toml

The first mount corresponds to an emptyDir. 第一个安装对应于一个emptyDir。 I would like to mount just one of the files from a configMap ("config") into the same mountPath. 我想将configMap(“ config”)中的文件之一挂载到同一mountPath中。

Is this even possible? 这有可能吗? The previous configuration throws: 先前的配置抛出:

 Error: Error response from daemon: Duplicate mount point '/var/opt/gitlab/gitaly'

Ok, here there is the solution, as I think someone else can have the same problem: 好的,这里有解决方案,因为我认为其他人也可能遇到相同的问题:

In order to mount only one file from the configMap on the very same path from another mount: 为了仅将configMap中的一个文件挂载在另一个挂载的相同路径上:

- mountPath: /var/opt/gitlab/gitaly/config.toml
          name: config
          subPath: config.toml

Any particular reason of the emptyDir mount? 挂载emptyDir的任何特殊原因? A solution would be to create the /var/opt/gitlab in the Dockerfile, eg: RUN mkdir -p /var/opt/gitlab/ and only use the configMap mounts. 一种解决方案是在Dockerfile中创建/ var / opt / gitlab,例如: RUN mkdir -p /var/opt/gitlab/并且仅使用configMap挂载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM