docker 挂载方式有-v 方式有以下方式

1.直接挂载目录

   volumeMounts:
                - name: configmap-volume-1
                  mountPath: /root
                  readOnly: false
          volumes:
            - name: configmap-volume-1
              configMap:
                name: api-server-conf

2.挂载指定文件
挂载之前需要改变文件权限为777,要不会引起修改宿主机上的文件 会引起内容不同步的问题

 volumeMounts:
                - name: configmap-volume-1
                  mountPath: /root//storage.conf
                  readOnly: false
                  subPath: storage.conf
                - name: configmap-volume-1
                  mountPath: /root//app.conf
                  readOnly: false
                  subPath: app.conf
          volumes:
            - name: configmap-volume-1
              configMap:
                name: api-server-conf
                items:
                  - key: storage.conf
                    path: storage.conf
                  - key: app.conf
                    path: app.conf
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐