How to mount multiple NFS mounts that point to the same place in a Docker image using docker-compose Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!multiple volumes to single target directory?How is Docker different from a virtual machine?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersHow does one remove an image in Docker?How to deal with persistent storage (e.g. databases) in DockerHow to copy Docker images from one host to another without using a repositoryDocker Compose vs. Dockerfile - which is better?How to persist data in a dockerized postgres database using volumesHow to add a volume from a diferent server to my docker-compose file

How can I reduce the gap between left and right of cdot with a macro?

Should I use a zero-interest credit card for a large one-time purchase?

How much damage would a cupful of neutron star matter do to the Earth?

Is there a kind of relay only consumes power when switching?

Sum letters are not two different

An adverb for when you're not exaggerating

AppleTVs create a chatty alternate WiFi network

What is "gratricide"?

What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?

How do I find out the mythology and history of my Fortress?

How do living politicians protect their readily obtainable signatures from misuse?

Why wasn't DOSKEY integrated with COMMAND.COM?

How to react to hostile behavior from a senior developer?

Why is my ESD wriststrap failing with nitrile gloves on?

Is a ledger board required if the side of my house is wood?

Find 108 by using 3,4,6

How to install press fit bottom bracket into new frame

Significance of Cersei's obsession with elephants?

Maximum summed subsequences with non-adjacent items

If Windows 7 doesn't support WSL, then what does Linux subsystem option mean?

Question about debouncing - delay of state change

Generate an RGB colour grid

Is there any word for a place full of confusion?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?



How to mount multiple NFS mounts that point to the same place in a Docker image using docker-compose



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!multiple volumes to single target directory?How is Docker different from a virtual machine?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersHow does one remove an image in Docker?How to deal with persistent storage (e.g. databases) in DockerHow to copy Docker images from one host to another without using a repositoryDocker Compose vs. Dockerfile - which is better?How to persist data in a dockerized postgres database using volumesHow to add a volume from a diferent server to my docker-compose file



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Different than this one here.



I want to link multiple NFS mounts that point to the same local location in a docker-compose image. I put the following lines in a docker-compose file:



volumes:
nfs3:
driver: local
driver_opts:
type: nfs
o: addr=172.16.20.5,rw
device: ":/tmp/mount1"
nfs4:
driver: local
driver_opts:
type: nfs
o: addr=172.16.20.6,rw
device: ":/tmp/mount2"


And then in the services part, I have a postgres instance that has the following volume config:



volumes:
- nfs3:/bitnami
- nfs4:/bitnami


Unfortunately, when I write to /bitnami, it only writes to /tmp/mount2 and not /tmp/mount1. Is there a good way to be able to write to both NFS mounts?










share|improve this question




























    0















    Different than this one here.



    I want to link multiple NFS mounts that point to the same local location in a docker-compose image. I put the following lines in a docker-compose file:



    volumes:
    nfs3:
    driver: local
    driver_opts:
    type: nfs
    o: addr=172.16.20.5,rw
    device: ":/tmp/mount1"
    nfs4:
    driver: local
    driver_opts:
    type: nfs
    o: addr=172.16.20.6,rw
    device: ":/tmp/mount2"


    And then in the services part, I have a postgres instance that has the following volume config:



    volumes:
    - nfs3:/bitnami
    - nfs4:/bitnami


    Unfortunately, when I write to /bitnami, it only writes to /tmp/mount2 and not /tmp/mount1. Is there a good way to be able to write to both NFS mounts?










    share|improve this question
























      0












      0








      0








      Different than this one here.



      I want to link multiple NFS mounts that point to the same local location in a docker-compose image. I put the following lines in a docker-compose file:



      volumes:
      nfs3:
      driver: local
      driver_opts:
      type: nfs
      o: addr=172.16.20.5,rw
      device: ":/tmp/mount1"
      nfs4:
      driver: local
      driver_opts:
      type: nfs
      o: addr=172.16.20.6,rw
      device: ":/tmp/mount2"


      And then in the services part, I have a postgres instance that has the following volume config:



      volumes:
      - nfs3:/bitnami
      - nfs4:/bitnami


      Unfortunately, when I write to /bitnami, it only writes to /tmp/mount2 and not /tmp/mount1. Is there a good way to be able to write to both NFS mounts?










      share|improve this question














      Different than this one here.



      I want to link multiple NFS mounts that point to the same local location in a docker-compose image. I put the following lines in a docker-compose file:



      volumes:
      nfs3:
      driver: local
      driver_opts:
      type: nfs
      o: addr=172.16.20.5,rw
      device: ":/tmp/mount1"
      nfs4:
      driver: local
      driver_opts:
      type: nfs
      o: addr=172.16.20.6,rw
      device: ":/tmp/mount2"


      And then in the services part, I have a postgres instance that has the following volume config:



      volumes:
      - nfs3:/bitnami
      - nfs4:/bitnami


      Unfortunately, when I write to /bitnami, it only writes to /tmp/mount2 and not /tmp/mount1. Is there a good way to be able to write to both NFS mounts?







      docker docker-compose nfs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 20:25









      AndreasKraljAndreasKralj

      326112




      326112






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The docker volume system uses the linux mount interface. Only one thing can be mounted at a time for a particular location. The most recent mount is the mount that is accessible.



          This question discusses what happens to files that were in a particular location when a mount happens.



          In your example, if files are only showing up on your /tmp/mount2 nfs share, then that was the most recent filesystem to be mounted at /bitnami.



          Similarly, if I try to mount two USB drives at the same location on a linux host, only the most recently mounted one will be the one available at that location.






          share|improve this answer























          • Gotcha, thanks for the answer! Do you recommend an alternate method of storing data from one Docker container to multiple devices at the same time?

            – AndreasKralj
            Mar 8 at 20:40






          • 1





            I don't see this as a docker specific question. Docker is just a thing that starts processes and sets up mounts for you, so you could restate your question as follows: How would one store data written by my process/application in more than one location?" There are lots of answers-- unison, rsync, change your application to write in two places, etc...

            – programmerq
            Mar 8 at 20:42











          • Thanks. I'll look into those. The specific application I'm using is postgresql so I'll try and find a way to do that with postgresql.

            – AndreasKralj
            Mar 8 at 20:43











          • Postgres does have replication features built in, but that usually means that you will be running different instances of postgres. What is your motivation to have one postgres with data in multiple places? It isn't really a common postgres question.

            – programmerq
            Mar 8 at 20:45











          • The main motivation is so that if one NFS server goes down, we have another that the postgresql container will write to as permanent storage. The reason to have the external storage on NFS servers is so that if the server hosting the Docker container goes down, we'll still have the posgresql data. If there's a better way, please let me know.

            – AndreasKralj
            Mar 8 at 20:50












          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%2f55070520%2fhow-to-mount-multiple-nfs-mounts-that-point-to-the-same-place-in-a-docker-image%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














          The docker volume system uses the linux mount interface. Only one thing can be mounted at a time for a particular location. The most recent mount is the mount that is accessible.



          This question discusses what happens to files that were in a particular location when a mount happens.



          In your example, if files are only showing up on your /tmp/mount2 nfs share, then that was the most recent filesystem to be mounted at /bitnami.



          Similarly, if I try to mount two USB drives at the same location on a linux host, only the most recently mounted one will be the one available at that location.






          share|improve this answer























          • Gotcha, thanks for the answer! Do you recommend an alternate method of storing data from one Docker container to multiple devices at the same time?

            – AndreasKralj
            Mar 8 at 20:40






          • 1





            I don't see this as a docker specific question. Docker is just a thing that starts processes and sets up mounts for you, so you could restate your question as follows: How would one store data written by my process/application in more than one location?" There are lots of answers-- unison, rsync, change your application to write in two places, etc...

            – programmerq
            Mar 8 at 20:42











          • Thanks. I'll look into those. The specific application I'm using is postgresql so I'll try and find a way to do that with postgresql.

            – AndreasKralj
            Mar 8 at 20:43











          • Postgres does have replication features built in, but that usually means that you will be running different instances of postgres. What is your motivation to have one postgres with data in multiple places? It isn't really a common postgres question.

            – programmerq
            Mar 8 at 20:45











          • The main motivation is so that if one NFS server goes down, we have another that the postgresql container will write to as permanent storage. The reason to have the external storage on NFS servers is so that if the server hosting the Docker container goes down, we'll still have the posgresql data. If there's a better way, please let me know.

            – AndreasKralj
            Mar 8 at 20:50
















          1














          The docker volume system uses the linux mount interface. Only one thing can be mounted at a time for a particular location. The most recent mount is the mount that is accessible.



          This question discusses what happens to files that were in a particular location when a mount happens.



          In your example, if files are only showing up on your /tmp/mount2 nfs share, then that was the most recent filesystem to be mounted at /bitnami.



          Similarly, if I try to mount two USB drives at the same location on a linux host, only the most recently mounted one will be the one available at that location.






          share|improve this answer























          • Gotcha, thanks for the answer! Do you recommend an alternate method of storing data from one Docker container to multiple devices at the same time?

            – AndreasKralj
            Mar 8 at 20:40






          • 1





            I don't see this as a docker specific question. Docker is just a thing that starts processes and sets up mounts for you, so you could restate your question as follows: How would one store data written by my process/application in more than one location?" There are lots of answers-- unison, rsync, change your application to write in two places, etc...

            – programmerq
            Mar 8 at 20:42











          • Thanks. I'll look into those. The specific application I'm using is postgresql so I'll try and find a way to do that with postgresql.

            – AndreasKralj
            Mar 8 at 20:43











          • Postgres does have replication features built in, but that usually means that you will be running different instances of postgres. What is your motivation to have one postgres with data in multiple places? It isn't really a common postgres question.

            – programmerq
            Mar 8 at 20:45











          • The main motivation is so that if one NFS server goes down, we have another that the postgresql container will write to as permanent storage. The reason to have the external storage on NFS servers is so that if the server hosting the Docker container goes down, we'll still have the posgresql data. If there's a better way, please let me know.

            – AndreasKralj
            Mar 8 at 20:50














          1












          1








          1







          The docker volume system uses the linux mount interface. Only one thing can be mounted at a time for a particular location. The most recent mount is the mount that is accessible.



          This question discusses what happens to files that were in a particular location when a mount happens.



          In your example, if files are only showing up on your /tmp/mount2 nfs share, then that was the most recent filesystem to be mounted at /bitnami.



          Similarly, if I try to mount two USB drives at the same location on a linux host, only the most recently mounted one will be the one available at that location.






          share|improve this answer













          The docker volume system uses the linux mount interface. Only one thing can be mounted at a time for a particular location. The most recent mount is the mount that is accessible.



          This question discusses what happens to files that were in a particular location when a mount happens.



          In your example, if files are only showing up on your /tmp/mount2 nfs share, then that was the most recent filesystem to be mounted at /bitnami.



          Similarly, if I try to mount two USB drives at the same location on a linux host, only the most recently mounted one will be the one available at that location.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 20:33









          programmerqprogrammerq

          3,606928




          3,606928












          • Gotcha, thanks for the answer! Do you recommend an alternate method of storing data from one Docker container to multiple devices at the same time?

            – AndreasKralj
            Mar 8 at 20:40






          • 1





            I don't see this as a docker specific question. Docker is just a thing that starts processes and sets up mounts for you, so you could restate your question as follows: How would one store data written by my process/application in more than one location?" There are lots of answers-- unison, rsync, change your application to write in two places, etc...

            – programmerq
            Mar 8 at 20:42











          • Thanks. I'll look into those. The specific application I'm using is postgresql so I'll try and find a way to do that with postgresql.

            – AndreasKralj
            Mar 8 at 20:43











          • Postgres does have replication features built in, but that usually means that you will be running different instances of postgres. What is your motivation to have one postgres with data in multiple places? It isn't really a common postgres question.

            – programmerq
            Mar 8 at 20:45











          • The main motivation is so that if one NFS server goes down, we have another that the postgresql container will write to as permanent storage. The reason to have the external storage on NFS servers is so that if the server hosting the Docker container goes down, we'll still have the posgresql data. If there's a better way, please let me know.

            – AndreasKralj
            Mar 8 at 20:50


















          • Gotcha, thanks for the answer! Do you recommend an alternate method of storing data from one Docker container to multiple devices at the same time?

            – AndreasKralj
            Mar 8 at 20:40






          • 1





            I don't see this as a docker specific question. Docker is just a thing that starts processes and sets up mounts for you, so you could restate your question as follows: How would one store data written by my process/application in more than one location?" There are lots of answers-- unison, rsync, change your application to write in two places, etc...

            – programmerq
            Mar 8 at 20:42











          • Thanks. I'll look into those. The specific application I'm using is postgresql so I'll try and find a way to do that with postgresql.

            – AndreasKralj
            Mar 8 at 20:43











          • Postgres does have replication features built in, but that usually means that you will be running different instances of postgres. What is your motivation to have one postgres with data in multiple places? It isn't really a common postgres question.

            – programmerq
            Mar 8 at 20:45











          • The main motivation is so that if one NFS server goes down, we have another that the postgresql container will write to as permanent storage. The reason to have the external storage on NFS servers is so that if the server hosting the Docker container goes down, we'll still have the posgresql data. If there's a better way, please let me know.

            – AndreasKralj
            Mar 8 at 20:50

















          Gotcha, thanks for the answer! Do you recommend an alternate method of storing data from one Docker container to multiple devices at the same time?

          – AndreasKralj
          Mar 8 at 20:40





          Gotcha, thanks for the answer! Do you recommend an alternate method of storing data from one Docker container to multiple devices at the same time?

          – AndreasKralj
          Mar 8 at 20:40




          1




          1





          I don't see this as a docker specific question. Docker is just a thing that starts processes and sets up mounts for you, so you could restate your question as follows: How would one store data written by my process/application in more than one location?" There are lots of answers-- unison, rsync, change your application to write in two places, etc...

          – programmerq
          Mar 8 at 20:42





          I don't see this as a docker specific question. Docker is just a thing that starts processes and sets up mounts for you, so you could restate your question as follows: How would one store data written by my process/application in more than one location?" There are lots of answers-- unison, rsync, change your application to write in two places, etc...

          – programmerq
          Mar 8 at 20:42













          Thanks. I'll look into those. The specific application I'm using is postgresql so I'll try and find a way to do that with postgresql.

          – AndreasKralj
          Mar 8 at 20:43





          Thanks. I'll look into those. The specific application I'm using is postgresql so I'll try and find a way to do that with postgresql.

          – AndreasKralj
          Mar 8 at 20:43













          Postgres does have replication features built in, but that usually means that you will be running different instances of postgres. What is your motivation to have one postgres with data in multiple places? It isn't really a common postgres question.

          – programmerq
          Mar 8 at 20:45





          Postgres does have replication features built in, but that usually means that you will be running different instances of postgres. What is your motivation to have one postgres with data in multiple places? It isn't really a common postgres question.

          – programmerq
          Mar 8 at 20:45













          The main motivation is so that if one NFS server goes down, we have another that the postgresql container will write to as permanent storage. The reason to have the external storage on NFS servers is so that if the server hosting the Docker container goes down, we'll still have the posgresql data. If there's a better way, please let me know.

          – AndreasKralj
          Mar 8 at 20:50






          The main motivation is so that if one NFS server goes down, we have another that the postgresql container will write to as permanent storage. The reason to have the external storage on NFS servers is so that if the server hosting the Docker container goes down, we'll still have the posgresql data. If there's a better way, please let me know.

          – AndreasKralj
          Mar 8 at 20:50




















          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%2f55070520%2fhow-to-mount-multiple-nfs-mounts-that-point-to-the-same-place-in-a-docker-image%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

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved