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