简体   繁体   English

如何在HOST中保留Docker数据

[英]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? 有一个docker数据库容器,在这种情况下是一个neo4j容器,如何保存数据,并确保下次启动neo4j docker映像时它指向我的HOST数据库而不是新数据库?

I am using Docker in windows, so boot2docker is being used. 我在windows中使用Docker,因此正在使用boot2docker。 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. 我说数据库,但我也在考虑如何提供一个目录,我正在运行一个Web应用程序,所以我不必提交图像的所有更改......我只想编辑一个我的Windows环境中的文件夹,并使用docker Web服务器堆栈进行调试。

The easiest way would be to have a shared folder between your Windows host and boot2docker VM ( This post can help ) 最简单的方法是在Windows主机和boot2docker VM之间建立一个共享文件夹( 这篇文章可以提供帮助

Then you just have to share that folder to your container using the -v option. 然后,您只需使用-v选项将该文件夹共享到容器中。

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 有关如何在容器和主机之间共享数据的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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