库伯奈特的音量安装问题。
mongo-express容器有一个文件/node-modules/mongo-express/config.js。
我需要用我的/node-modules/mongo-express/config.js覆盖/tmp/config.js
我正在尝试将自定义config.js在/tmp (卷挂载由ConfigMaps)下复制到容器路径/节点-模块/mongo下的文件夹中。
但我无法做到这一点,并得到以下错误:
cp:无法创建‘/node_node/mongo/config.js’:文件存在
下面我们可以找到我用来实现这一目标的deployment.yaml。
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo-express
spec:
selector:
matchLabels:
app: mongo-express
template:
metadata:
labels:
app: mongo-express
spec:
containers:
- name: mongo-express
image: mongo-express:latest
command:
- sh
- -c
- cp /tmp/config.js /node_modules/mongo-express
ports:
- name: mongo-express
containerPort: 8081
volumeMounts:
- name: custom-config-js
mountPath: /tmp
volumes:
- name: custom-config-js
configMap:
name: mongodb-express-config-js我试过:
/node_modules/mongo-express
还有更多。但没有成功,。任何帮助都是非常感谢的。
发布于 2021-08-10 21:12:46
大多数容器映像是不可变的。
您可能需要的是一个subPath挂载,而不是:
volumeMounts:
- mountPath: /node_modules/mongo-express/config.js
name: custom-config-js
subPath: config.jshttps://stackoverflow.com/questions/68731101
复制相似问题