简体   繁体   中英

How to persist Docker data in HOST

Having a docker database container, in this case a neo4j container, how can I persist the data, and make sure that the next time I start a neo4j docker image that it points to my HOST database and not a new database?

I am using Docker in windows, so boot2docker is being used. And I say database but I am also thinking how do I serve a directory that I am working on a web application to be run, so I don't have to commit all the changes to the image... I just want to edit a folder in my windows environment and debug it using a docker web server stack.

The easiest way would be to have a shared folder between your Windows host and boot2docker VM ( This post can help )

Then you just have to share that folder to your container using the -v option.

docker run -d -v /path/to/shared/folder/in/VM:/path/to/folder/in/container myimage /cmd

More info on how to share data between container and host

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM