github.com/toophy/docker@v1.8.2/docs/examples/couchdb_data_volumes.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Dockerizing a CouchDB service"
     4  description = "Sharing data between 2 couchdb databases"
     5  keywords = ["docker, example, package installation, networking, couchdb,  data volumes"]
     6  [menu.main]
     7  parent = "smn_applied"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # Dockerizing a CouchDB service
    12  
    13  > **Note**: 
    14  > - **If you don't like sudo** then see [*Giving non-root
    15  >   access*](/installation/binaries/#giving-non-root-access)
    16  
    17  Here's an example of using data volumes to share the same data between
    18  two CouchDB containers. This could be used for hot upgrades, testing
    19  different versions of CouchDB on the same data, etc.
    20  
    21  ## Create first database
    22  
    23  Note that we're marking `/var/lib/couchdb` as a data volume.
    24  
    25      $ COUCH1=$(docker run -d -p 5984 -v /var/lib/couchdb shykes/couchdb:2013-05-03)
    26  
    27  ## Add data to the first database
    28  
    29  We're assuming your Docker host is reachable at `localhost`. If not,
    30  replace `localhost` with the public IP of your Docker host.
    31  
    32      $ HOST=localhost
    33      $ URL="http://$HOST:$(docker port $COUCH1 5984 | grep -o '[1-9][0-9]*$')/_utils/"
    34      $ echo "Navigate to $URL in your browser, and use the couch interface to add data"
    35  
    36  ## Create second database
    37  
    38  This time, we're requesting shared access to `$COUCH1`'s volumes.
    39  
    40      $ COUCH2=$(docker run -d -p 5984 --volumes-from $COUCH1 shykes/couchdb:2013-05-03)
    41  
    42  ## Browse data on the second database
    43  
    44      $ HOST=localhost
    45      $ URL="http://$HOST:$(docker port $COUCH2 5984 | grep -o '[1-9][0-9]*$')/_utils/"
    46      $ echo "Navigate to $URL in your browser. You should see the same data as in the first database"'!'
    47  
    48  Congratulations, you are now running two Couchdb containers, completely
    49  isolated from each other *except* for their data.