Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.
You can use this example for a generic environment like:
The sintaxe -V HOST_DIR:CONTAINER_DIR is very useful for file sharing between the host and one or more containers. For example, configuration files can be kept into host and mounted at containers built from generic images. We can also share data between containers using the parameter --volumes-from CONTAINER along with docker run. We could create, for example, a new container that has access to the volumes of different containers. For example:
$ docker run -it -h SECONDCONTAINER --volumes-from MYFIRSTCONTAINER -test debian /bin/bash root@SECONDCONTAINER:/# ls /data drwxrws--- 3 398536 871173 512 Apr 18 2011 WarrantyInformation drwxrws--- 4 205664 871173 512 Oct 29 2013 BrowseAndBuy drwxrws--- 4 205664 871173 512 Oct 29 2013 css drwxrws--- 4 205664 871173 512 Oct 29 2013 RFQ drwxrws--- 3 205664 871173 512 Oct 29 2013 ShippingInformation drwxrws--- 3 441825 871173 512 Oct 30 2014 Search drwxrws--- 2 441825 871173 512 Jan 5 2015 UsingPTX drwxrws--- 2 441825 871173 512 Jan 5 2015 Glossary drwxrws--- 2 441825 871173 512 Jan 5 2015 FAQs -rwxrwx--- 1 398536 871173 11403 Apr 21 2015 siteunavailable_old.html -rwxrwx--- 1 398536 871173 14679 Apr 21 2015 siteunavailable.html -rwxrwx--- 1 398536 871173 15597 Apr 21 2015 redirect.html -rwxrwx--- 1 398536 871173 16655 Apr 21 2015 index.html drwxrws--- 6 398536 871173 512 Dec 30 2016 images drwxrws--- 2 289468 871173 512 Mar 7 2017 LOGS drwxrws--- 2 289468 871173 512 Jul 2 2017 reports -rwxrwx--- 1 300690 871173 34875 Jan 17 20:08 backsoon.jpg drwxrws--- 2 300690 871173 512 Jan 19 23:10 command drwxrws--- 5 205664 871173 512 Apr 12 20:07 WelcomePage drwxrws--- 6 205664 871173 512 Apr 12 20:07 TermsAndConditions drwxrws--- 11 205664 871173 512 Apr 12 20:07 Help drwxrws--- 2 480162 871173 12288 Jun 27 12:12 html drwxrwx--- 3 289468 871173 512 Jun 29 14:50 Offering drwxrwx--- 5 289468 871173 512 Jun 29 15:24 temp_cpt root@SECONDCONTAINER:/#
In this example, there was a container with volume created into my host docker-daemon.
Share your tries!
Copy