docker container directory gets overwritten by persistent volume (claim)Kubectl apply for a deployment with revHistoryLimit 0 does not delete the old replica set, here is my deploment templateKubernetes : Dynamic Storage Provisioning using host-pathKubernetes doesn't allow to mount file to containerGoogle Kubernetes Engine: Not seeing mount persistent volume in the instanceHow to mount a volume with a windows container in kubernetes?Share nfs volume between kubernetes clustersAccess stateful headless kubernetes externally?Not able to see Pod when I create a Jobkubernetes deployment with argskubeadm install flannel get error, what's wrong?

C-152 carb heat on before landing in hot weather?

What is the legal status of travelling with methadone in your carry-on?

Why aren't cotton tents more popular?

Can any NP-Complete Problem be solved using at most polynomial space (but while using exponential time?)

Impossible darts scores

Does x-ray lead paint detection find lead underneath latex topcoats?

Is there a maximum distance from a planet that a moon can orbit?

Is my Rep in Stack-Exchange Form?

Why do some professors with PhDs leave their professorships to teach high school?

Accidentals and ties

Why do some games show lights shine thorugh walls?

Does Marvel have an equivalent of the Green Lantern?

How would a drone work in centrifugal force generated "gravity"?

Archery in modern conflicts

Computing a trigonometric integral

Should developer taking test phones home or put in office?

What is the mechanical difference between the Spectator's Create Food and Water action and the Banshee's Undead Nature Trait?

How was Hillel permitted to go to the skylight to hear the shiur

Hot coffee brewing solutions for deep woods camping

Links to webpages in books

How does a blind passenger not die, if driver becomes unconscious

The Target Principal Name Is Incorrect. Cannot Generate SSPI Context (SQL or AD Issue)?

Apply brace expansion in "reverse order"

How to split an equation in two lines?



docker container directory gets overwritten by persistent volume (claim)


Kubectl apply for a deployment with revHistoryLimit 0 does not delete the old replica set, here is my deploment templateKubernetes : Dynamic Storage Provisioning using host-pathKubernetes doesn't allow to mount file to containerGoogle Kubernetes Engine: Not seeing mount persistent volume in the instanceHow to mount a volume with a windows container in kubernetes?Share nfs volume between kubernetes clustersAccess stateful headless kubernetes externally?Not able to see Pod when I create a Jobkubernetes deployment with argskubeadm install flannel get error, what's wrong?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm deploying locally in docker-for-desktop. So that I can migrate to a kubernetes cluster in the future.



However I face a problem. Directories in the docker container/pod are over written, when persistent volumes are used.



I'm pulling the latest SonarQube image. A lot of plugins and quality profiles are pre-installed. Which is exactly what I want. If I don't use persistent volumes. Everything works as expected. When I use a pv all the data in the image is overwritten. I use helm.



In my deployment.yaml I use this:



 - if (eq .Values.volumes.usePersistent "true") 
volumeMounts:
- mountPath: "/opt/sonarqube/data"
name: sonarqube-data
- mountPath: "/opt/sonarqube/extensions"
name: sonarqube-extensions
volumes:
- name: sonarqube-data
persistentVolumeClaim:
claimName: sonarqube-data-pv-claim
- name: sonarqube-extensions
persistentVolumeClaim:
claimName: sonarqube-extensions-pv-claim
- end


In my storage.yaml I use this:



- if (eq .Values.volumes.usePersistent "true") 
kind: PersistentVolume
apiVersion: v1
metadata:
name: sonarqube-data-pv-volume
labels:
type: local
app: sonarqube-data
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/tmp/toolbox/sonarqube/data"
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: sonarqube-extensions-pv-volume
labels:
type: local
app: sonarqube-extensions
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/tmp/toolbox/sonarqube/extensions"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sonarqube-data-pv-claim
labels:
app: sonarqube-data
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sonarqube-extensions-pv-claim
labels:
app: sonarqube-extensions
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
- end


The pvc are bounded and working.
All the data that I need are in de 'data' and 'extensions' folder in the container, coming from the image.
For example in the extensions folder:



sonarqube@sonarqube-deployment-6b8bdfb766-klnwh:/opt/sonarqube/extensions/plugins$ ls
README.txt sonar-java-plugin-5.11.0.17289.jar sonar-scala-plugin-1.5.0.315.jar
sonar-csharp-plugin-7.11.0.8083.jar sonar-javascript-plugin-5.1.1.7506.jar sonar-scm-git-plugin-1.8.0.1574.jar
sonar-css-plugin-1.0.3.724.jar sonar-kotlin-plugin-1.5.0.315.jar sonar-scm-svn-plugin-1.9.0.1295.jar
sonar-flex-plugin-2.4.0.1222.jar sonar-ldap-plugin-2.2.0.608.jar sonar-typescript-plugin-1.9.0.3766.jar
sonar-go-plugin-1.1.0.1612.jar sonar-php-plugin-3.0.0.4537.jar sonar-vbnet-plugin-7.11.0.8083.jar
sonar-html-plugin-3.1.0.1615.jar sonar-python-plugin-1.13.0.2922.jar sonar-xml-plugin-2.0.1.2020.jar
sonar-jacoco-plugin-1.0.1.143.jar sonar-ruby-plugin-1.5.0.315.jar


I have made the following directories in my /tmp folder:



- data
- extensions
- downloads
- jdbc-driver
- plugins


I know I must specify the same folders in my pv as in my container.
I checked, all the folders are there in my /tmp folder. But are empty.
They plugins folder is empty, all the plugin.jar files are gone.



BTW I did not include this in the initial post, but I'm using a PostgresDB also with pvc. pg-deploy.yaml:




- if (eq .Values.volumes.usePersistent "true")
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: sonarqubedb
volumes:
- name: sonarqubedb
persistentVolumeClaim:
claimName: postgres-sq-pv-claim
- end



storage.yaml:



- if (eq .Values.volumes.usePersistent "true") 
kind: PersistentVolume
apiVersion: v1
metadata:
name: postgres-sq-pv-volume
labels:
type: local
app: postgres-sonarqube
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/tmp/toolbox/postgres-sonarqube"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-sq-pv-claim
labels:
app: postgres-sonarqube
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
- end









share|improve this question






























    0















    I'm deploying locally in docker-for-desktop. So that I can migrate to a kubernetes cluster in the future.



    However I face a problem. Directories in the docker container/pod are over written, when persistent volumes are used.



    I'm pulling the latest SonarQube image. A lot of plugins and quality profiles are pre-installed. Which is exactly what I want. If I don't use persistent volumes. Everything works as expected. When I use a pv all the data in the image is overwritten. I use helm.



    In my deployment.yaml I use this:



     - if (eq .Values.volumes.usePersistent "true") 
    volumeMounts:
    - mountPath: "/opt/sonarqube/data"
    name: sonarqube-data
    - mountPath: "/opt/sonarqube/extensions"
    name: sonarqube-extensions
    volumes:
    - name: sonarqube-data
    persistentVolumeClaim:
    claimName: sonarqube-data-pv-claim
    - name: sonarqube-extensions
    persistentVolumeClaim:
    claimName: sonarqube-extensions-pv-claim
    - end


    In my storage.yaml I use this:



    - if (eq .Values.volumes.usePersistent "true") 
    kind: PersistentVolume
    apiVersion: v1
    metadata:
    name: sonarqube-data-pv-volume
    labels:
    type: local
    app: sonarqube-data
    spec:
    storageClassName: manual
    capacity:
    storage: 2Gi
    accessModes:
    - ReadWriteMany
    hostPath:
    path: "/tmp/toolbox/sonarqube/data"
    ---
    kind: PersistentVolume
    apiVersion: v1
    metadata:
    name: sonarqube-extensions-pv-volume
    labels:
    type: local
    app: sonarqube-extensions
    spec:
    storageClassName: manual
    capacity:
    storage: 2Gi
    accessModes:
    - ReadWriteMany
    hostPath:
    path: "/tmp/toolbox/sonarqube/extensions"
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: sonarqube-data-pv-claim
    labels:
    app: sonarqube-data
    spec:
    storageClassName: manual
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: 2Gi
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: sonarqube-extensions-pv-claim
    labels:
    app: sonarqube-extensions
    spec:
    storageClassName: manual
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: 2Gi
    - end


    The pvc are bounded and working.
    All the data that I need are in de 'data' and 'extensions' folder in the container, coming from the image.
    For example in the extensions folder:



    sonarqube@sonarqube-deployment-6b8bdfb766-klnwh:/opt/sonarqube/extensions/plugins$ ls
    README.txt sonar-java-plugin-5.11.0.17289.jar sonar-scala-plugin-1.5.0.315.jar
    sonar-csharp-plugin-7.11.0.8083.jar sonar-javascript-plugin-5.1.1.7506.jar sonar-scm-git-plugin-1.8.0.1574.jar
    sonar-css-plugin-1.0.3.724.jar sonar-kotlin-plugin-1.5.0.315.jar sonar-scm-svn-plugin-1.9.0.1295.jar
    sonar-flex-plugin-2.4.0.1222.jar sonar-ldap-plugin-2.2.0.608.jar sonar-typescript-plugin-1.9.0.3766.jar
    sonar-go-plugin-1.1.0.1612.jar sonar-php-plugin-3.0.0.4537.jar sonar-vbnet-plugin-7.11.0.8083.jar
    sonar-html-plugin-3.1.0.1615.jar sonar-python-plugin-1.13.0.2922.jar sonar-xml-plugin-2.0.1.2020.jar
    sonar-jacoco-plugin-1.0.1.143.jar sonar-ruby-plugin-1.5.0.315.jar


    I have made the following directories in my /tmp folder:



    - data
    - extensions
    - downloads
    - jdbc-driver
    - plugins


    I know I must specify the same folders in my pv as in my container.
    I checked, all the folders are there in my /tmp folder. But are empty.
    They plugins folder is empty, all the plugin.jar files are gone.



    BTW I did not include this in the initial post, but I'm using a PostgresDB also with pvc. pg-deploy.yaml:




    - if (eq .Values.volumes.usePersistent "true")
    volumeMounts:
    - mountPath: /var/lib/postgresql/data
    name: sonarqubedb
    volumes:
    - name: sonarqubedb
    persistentVolumeClaim:
    claimName: postgres-sq-pv-claim
    - end



    storage.yaml:



    - if (eq .Values.volumes.usePersistent "true") 
    kind: PersistentVolume
    apiVersion: v1
    metadata:
    name: postgres-sq-pv-volume
    labels:
    type: local
    app: postgres-sonarqube
    spec:
    storageClassName: manual
    capacity:
    storage: 2Gi
    accessModes:
    - ReadWriteMany
    hostPath:
    path: "/tmp/toolbox/postgres-sonarqube"
    ---
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
    name: postgres-sq-pv-claim
    labels:
    app: postgres-sonarqube
    spec:
    storageClassName: manual
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: 2Gi
    - end









    share|improve this question


























      0












      0








      0








      I'm deploying locally in docker-for-desktop. So that I can migrate to a kubernetes cluster in the future.



      However I face a problem. Directories in the docker container/pod are over written, when persistent volumes are used.



      I'm pulling the latest SonarQube image. A lot of plugins and quality profiles are pre-installed. Which is exactly what I want. If I don't use persistent volumes. Everything works as expected. When I use a pv all the data in the image is overwritten. I use helm.



      In my deployment.yaml I use this:



       - if (eq .Values.volumes.usePersistent "true") 
      volumeMounts:
      - mountPath: "/opt/sonarqube/data"
      name: sonarqube-data
      - mountPath: "/opt/sonarqube/extensions"
      name: sonarqube-extensions
      volumes:
      - name: sonarqube-data
      persistentVolumeClaim:
      claimName: sonarqube-data-pv-claim
      - name: sonarqube-extensions
      persistentVolumeClaim:
      claimName: sonarqube-extensions-pv-claim
      - end


      In my storage.yaml I use this:



      - if (eq .Values.volumes.usePersistent "true") 
      kind: PersistentVolume
      apiVersion: v1
      metadata:
      name: sonarqube-data-pv-volume
      labels:
      type: local
      app: sonarqube-data
      spec:
      storageClassName: manual
      capacity:
      storage: 2Gi
      accessModes:
      - ReadWriteMany
      hostPath:
      path: "/tmp/toolbox/sonarqube/data"
      ---
      kind: PersistentVolume
      apiVersion: v1
      metadata:
      name: sonarqube-extensions-pv-volume
      labels:
      type: local
      app: sonarqube-extensions
      spec:
      storageClassName: manual
      capacity:
      storage: 2Gi
      accessModes:
      - ReadWriteMany
      hostPath:
      path: "/tmp/toolbox/sonarqube/extensions"
      ---
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
      name: sonarqube-data-pv-claim
      labels:
      app: sonarqube-data
      spec:
      storageClassName: manual
      accessModes:
      - ReadWriteMany
      resources:
      requests:
      storage: 2Gi
      ---
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
      name: sonarqube-extensions-pv-claim
      labels:
      app: sonarqube-extensions
      spec:
      storageClassName: manual
      accessModes:
      - ReadWriteMany
      resources:
      requests:
      storage: 2Gi
      - end


      The pvc are bounded and working.
      All the data that I need are in de 'data' and 'extensions' folder in the container, coming from the image.
      For example in the extensions folder:



      sonarqube@sonarqube-deployment-6b8bdfb766-klnwh:/opt/sonarqube/extensions/plugins$ ls
      README.txt sonar-java-plugin-5.11.0.17289.jar sonar-scala-plugin-1.5.0.315.jar
      sonar-csharp-plugin-7.11.0.8083.jar sonar-javascript-plugin-5.1.1.7506.jar sonar-scm-git-plugin-1.8.0.1574.jar
      sonar-css-plugin-1.0.3.724.jar sonar-kotlin-plugin-1.5.0.315.jar sonar-scm-svn-plugin-1.9.0.1295.jar
      sonar-flex-plugin-2.4.0.1222.jar sonar-ldap-plugin-2.2.0.608.jar sonar-typescript-plugin-1.9.0.3766.jar
      sonar-go-plugin-1.1.0.1612.jar sonar-php-plugin-3.0.0.4537.jar sonar-vbnet-plugin-7.11.0.8083.jar
      sonar-html-plugin-3.1.0.1615.jar sonar-python-plugin-1.13.0.2922.jar sonar-xml-plugin-2.0.1.2020.jar
      sonar-jacoco-plugin-1.0.1.143.jar sonar-ruby-plugin-1.5.0.315.jar


      I have made the following directories in my /tmp folder:



      - data
      - extensions
      - downloads
      - jdbc-driver
      - plugins


      I know I must specify the same folders in my pv as in my container.
      I checked, all the folders are there in my /tmp folder. But are empty.
      They plugins folder is empty, all the plugin.jar files are gone.



      BTW I did not include this in the initial post, but I'm using a PostgresDB also with pvc. pg-deploy.yaml:




      - if (eq .Values.volumes.usePersistent "true")
      volumeMounts:
      - mountPath: /var/lib/postgresql/data
      name: sonarqubedb
      volumes:
      - name: sonarqubedb
      persistentVolumeClaim:
      claimName: postgres-sq-pv-claim
      - end



      storage.yaml:



      - if (eq .Values.volumes.usePersistent "true") 
      kind: PersistentVolume
      apiVersion: v1
      metadata:
      name: postgres-sq-pv-volume
      labels:
      type: local
      app: postgres-sonarqube
      spec:
      storageClassName: manual
      capacity:
      storage: 2Gi
      accessModes:
      - ReadWriteMany
      hostPath:
      path: "/tmp/toolbox/postgres-sonarqube"
      ---
      kind: PersistentVolumeClaim
      apiVersion: v1
      metadata:
      name: postgres-sq-pv-claim
      labels:
      app: postgres-sonarqube
      spec:
      storageClassName: manual
      accessModes:
      - ReadWriteMany
      resources:
      requests:
      storage: 2Gi
      - end









      share|improve this question
















      I'm deploying locally in docker-for-desktop. So that I can migrate to a kubernetes cluster in the future.



      However I face a problem. Directories in the docker container/pod are over written, when persistent volumes are used.



      I'm pulling the latest SonarQube image. A lot of plugins and quality profiles are pre-installed. Which is exactly what I want. If I don't use persistent volumes. Everything works as expected. When I use a pv all the data in the image is overwritten. I use helm.



      In my deployment.yaml I use this:



       - if (eq .Values.volumes.usePersistent "true") 
      volumeMounts:
      - mountPath: "/opt/sonarqube/data"
      name: sonarqube-data
      - mountPath: "/opt/sonarqube/extensions"
      name: sonarqube-extensions
      volumes:
      - name: sonarqube-data
      persistentVolumeClaim:
      claimName: sonarqube-data-pv-claim
      - name: sonarqube-extensions
      persistentVolumeClaim:
      claimName: sonarqube-extensions-pv-claim
      - end


      In my storage.yaml I use this:



      - if (eq .Values.volumes.usePersistent "true") 
      kind: PersistentVolume
      apiVersion: v1
      metadata:
      name: sonarqube-data-pv-volume
      labels:
      type: local
      app: sonarqube-data
      spec:
      storageClassName: manual
      capacity:
      storage: 2Gi
      accessModes:
      - ReadWriteMany
      hostPath:
      path: "/tmp/toolbox/sonarqube/data"
      ---
      kind: PersistentVolume
      apiVersion: v1
      metadata:
      name: sonarqube-extensions-pv-volume
      labels:
      type: local
      app: sonarqube-extensions
      spec:
      storageClassName: manual
      capacity:
      storage: 2Gi
      accessModes:
      - ReadWriteMany
      hostPath:
      path: "/tmp/toolbox/sonarqube/extensions"
      ---
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
      name: sonarqube-data-pv-claim
      labels:
      app: sonarqube-data
      spec:
      storageClassName: manual
      accessModes:
      - ReadWriteMany
      resources:
      requests:
      storage: 2Gi
      ---
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
      name: sonarqube-extensions-pv-claim
      labels:
      app: sonarqube-extensions
      spec:
      storageClassName: manual
      accessModes:
      - ReadWriteMany
      resources:
      requests:
      storage: 2Gi
      - end


      The pvc are bounded and working.
      All the data that I need are in de 'data' and 'extensions' folder in the container, coming from the image.
      For example in the extensions folder:



      sonarqube@sonarqube-deployment-6b8bdfb766-klnwh:/opt/sonarqube/extensions/plugins$ ls
      README.txt sonar-java-plugin-5.11.0.17289.jar sonar-scala-plugin-1.5.0.315.jar
      sonar-csharp-plugin-7.11.0.8083.jar sonar-javascript-plugin-5.1.1.7506.jar sonar-scm-git-plugin-1.8.0.1574.jar
      sonar-css-plugin-1.0.3.724.jar sonar-kotlin-plugin-1.5.0.315.jar sonar-scm-svn-plugin-1.9.0.1295.jar
      sonar-flex-plugin-2.4.0.1222.jar sonar-ldap-plugin-2.2.0.608.jar sonar-typescript-plugin-1.9.0.3766.jar
      sonar-go-plugin-1.1.0.1612.jar sonar-php-plugin-3.0.0.4537.jar sonar-vbnet-plugin-7.11.0.8083.jar
      sonar-html-plugin-3.1.0.1615.jar sonar-python-plugin-1.13.0.2922.jar sonar-xml-plugin-2.0.1.2020.jar
      sonar-jacoco-plugin-1.0.1.143.jar sonar-ruby-plugin-1.5.0.315.jar


      I have made the following directories in my /tmp folder:



      - data
      - extensions
      - downloads
      - jdbc-driver
      - plugins


      I know I must specify the same folders in my pv as in my container.
      I checked, all the folders are there in my /tmp folder. But are empty.
      They plugins folder is empty, all the plugin.jar files are gone.



      BTW I did not include this in the initial post, but I'm using a PostgresDB also with pvc. pg-deploy.yaml:




      - if (eq .Values.volumes.usePersistent "true")
      volumeMounts:
      - mountPath: /var/lib/postgresql/data
      name: sonarqubedb
      volumes:
      - name: sonarqubedb
      persistentVolumeClaim:
      claimName: postgres-sq-pv-claim
      - end



      storage.yaml:



      - if (eq .Values.volumes.usePersistent "true") 
      kind: PersistentVolume
      apiVersion: v1
      metadata:
      name: postgres-sq-pv-volume
      labels:
      type: local
      app: postgres-sonarqube
      spec:
      storageClassName: manual
      capacity:
      storage: 2Gi
      accessModes:
      - ReadWriteMany
      hostPath:
      path: "/tmp/toolbox/postgres-sonarqube"
      ---
      kind: PersistentVolumeClaim
      apiVersion: v1
      metadata:
      name: postgres-sq-pv-claim
      labels:
      app: postgres-sonarqube
      spec:
      storageClassName: manual
      accessModes:
      - ReadWriteMany
      resources:
      requests:
      storage: 2Gi
      - end






      kubernetes persistent volumes






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 10:55







      B.Kingma

















      asked Mar 25 at 8:32









      B.KingmaB.Kingma

      143 bronze badges




      143 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          to avoid overwriting data to the the existing files/content inside the same Directory, you can use subpath to mount the data and extensions directory (In the example below) in the existing Container file system. for further detail sub-path



           volumeMounts:
          - mountPath: "/opt/sonarqube/data"
          name: sonarqube-data
          subPath: data
          - mountPath: "/opt/sonarqube/extensions"
          name: sonarqube-extensions
          subPath: extensions


          This works. However it didn't work until I did the same for the database that sonarqube is using:



           volumeMounts:
          - mountPath: /var/lib/postgresql/data
          name: sonarqubedb
          subPath: data





          share|improve this answer

























          • Thanks for your reply. I tried it. It didn't work. Should I delete all subfolders in the /data and /extensions folders (locally)?

            – B.Kingma
            Mar 25 at 10:10












          • you can try it and see what happens

            – Suresh Vishnoi
            Mar 25 at 10:18














          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55333835%2fdocker-container-directory-gets-overwritten-by-persistent-volume-claim%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          to avoid overwriting data to the the existing files/content inside the same Directory, you can use subpath to mount the data and extensions directory (In the example below) in the existing Container file system. for further detail sub-path



           volumeMounts:
          - mountPath: "/opt/sonarqube/data"
          name: sonarqube-data
          subPath: data
          - mountPath: "/opt/sonarqube/extensions"
          name: sonarqube-extensions
          subPath: extensions


          This works. However it didn't work until I did the same for the database that sonarqube is using:



           volumeMounts:
          - mountPath: /var/lib/postgresql/data
          name: sonarqubedb
          subPath: data





          share|improve this answer

























          • Thanks for your reply. I tried it. It didn't work. Should I delete all subfolders in the /data and /extensions folders (locally)?

            – B.Kingma
            Mar 25 at 10:10












          • you can try it and see what happens

            – Suresh Vishnoi
            Mar 25 at 10:18
















          1














          to avoid overwriting data to the the existing files/content inside the same Directory, you can use subpath to mount the data and extensions directory (In the example below) in the existing Container file system. for further detail sub-path



           volumeMounts:
          - mountPath: "/opt/sonarqube/data"
          name: sonarqube-data
          subPath: data
          - mountPath: "/opt/sonarqube/extensions"
          name: sonarqube-extensions
          subPath: extensions


          This works. However it didn't work until I did the same for the database that sonarqube is using:



           volumeMounts:
          - mountPath: /var/lib/postgresql/data
          name: sonarqubedb
          subPath: data





          share|improve this answer

























          • Thanks for your reply. I tried it. It didn't work. Should I delete all subfolders in the /data and /extensions folders (locally)?

            – B.Kingma
            Mar 25 at 10:10












          • you can try it and see what happens

            – Suresh Vishnoi
            Mar 25 at 10:18














          1












          1








          1







          to avoid overwriting data to the the existing files/content inside the same Directory, you can use subpath to mount the data and extensions directory (In the example below) in the existing Container file system. for further detail sub-path



           volumeMounts:
          - mountPath: "/opt/sonarqube/data"
          name: sonarqube-data
          subPath: data
          - mountPath: "/opt/sonarqube/extensions"
          name: sonarqube-extensions
          subPath: extensions


          This works. However it didn't work until I did the same for the database that sonarqube is using:



           volumeMounts:
          - mountPath: /var/lib/postgresql/data
          name: sonarqubedb
          subPath: data





          share|improve this answer















          to avoid overwriting data to the the existing files/content inside the same Directory, you can use subpath to mount the data and extensions directory (In the example below) in the existing Container file system. for further detail sub-path



           volumeMounts:
          - mountPath: "/opt/sonarqube/data"
          name: sonarqube-data
          subPath: data
          - mountPath: "/opt/sonarqube/extensions"
          name: sonarqube-extensions
          subPath: extensions


          This works. However it didn't work until I did the same for the database that sonarqube is using:



           volumeMounts:
          - mountPath: /var/lib/postgresql/data
          name: sonarqubedb
          subPath: data






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 8 at 14:10









          B.Kingma

          143 bronze badges




          143 bronze badges










          answered Mar 25 at 9:30









          Suresh VishnoiSuresh Vishnoi

          4,3583 gold badges13 silver badges32 bronze badges




          4,3583 gold badges13 silver badges32 bronze badges












          • Thanks for your reply. I tried it. It didn't work. Should I delete all subfolders in the /data and /extensions folders (locally)?

            – B.Kingma
            Mar 25 at 10:10












          • you can try it and see what happens

            – Suresh Vishnoi
            Mar 25 at 10:18


















          • Thanks for your reply. I tried it. It didn't work. Should I delete all subfolders in the /data and /extensions folders (locally)?

            – B.Kingma
            Mar 25 at 10:10












          • you can try it and see what happens

            – Suresh Vishnoi
            Mar 25 at 10:18

















          Thanks for your reply. I tried it. It didn't work. Should I delete all subfolders in the /data and /extensions folders (locally)?

          – B.Kingma
          Mar 25 at 10:10






          Thanks for your reply. I tried it. It didn't work. Should I delete all subfolders in the /data and /extensions folders (locally)?

          – B.Kingma
          Mar 25 at 10:10














          you can try it and see what happens

          – Suresh Vishnoi
          Mar 25 at 10:18






          you can try it and see what happens

          – Suresh Vishnoi
          Mar 25 at 10:18




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55333835%2fdocker-container-directory-gets-overwritten-by-persistent-volume-claim%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현