Boot2Docker(在Windows上)运行Mongo与共享文件夹(不支持此文件系统) [英] Boot2Docker (on Windows) running Mongo with shared folder (This file system is not supported)
问题描述
我正在使用Boot2Docker在Windows上使用共享文件夹启动Mongo容器。当开始使用运行-it -v / c / Users / 310145787 / Desktop / mongo:/ data / db mongo
我在容器中收到一条警告消息:
警告:不支持此文件系统。
之后立即启动mongo shutsdown。
有关如何解决这个问题的任何提示或提示?
显然,根据这个要点和 Sev( sevastos
),mongo不支持通过VirtualBox共享文件夹安装卷:
请参阅mongoDB Productions Notes :
MongoDB需要支持
fsync()的文件系统
目录。
例如,HGFS和Virtual Box的共享文件夹不支持此操作。
所有的最简单的解决方案和数据持久性的正确方法是 数据卷 :
假设你有一个容器有VOLUME [
/ data
]
#创建数据卷
docker create -v / data --name yourData busybox true
#并使用
docker run - -volumes-from yourData ...
这是总是很理想(但以下为Mac, Edward Chu( chuyik
)):
我不认为这是一个很好的解决方案,因为数据刚刚移动到另一个容器?
但它仍然在容器内,而不是本地系统(mac磁盘)。
我发现另一个解决方案,就是使用sshfs来在boot2docker vm和mac之间映射数据,这可能会更好,因为数据没有存储在linux容器中。
创建一个目录来存储boot2docker内的数据:
boot2docker ssh
mkdir -p / mnt / sda1 / dev
使用sshfs链接boot2docker和mac:
echo tcuser | sshfs docker @ localhost:/ mnt / sda1 / dev&您的mac dir路径> -p 2022 -o password_stdin
使用mongo安装运行映像: p>
docker run -v / mnt / sda1 / dev:/ data / db< mongodb-image> ; mongod
相应的boot2docker问题指出 docker issue 12590(1.6#12590中的-v共享文件夹的问题),它指向使用双斜杠的工作。
使用双斜杠似乎工作。我在本地检查它,它可以工作。
docker run -d -v // c / Users / marco / Desktop / data:/ data< image name>
它也适用于
< blockquote>
docker run -v / $(pwd):/ data
I am trying to start a Mongo container using shared folders on Windows using Boot2Docker. When starting using
run -it -v /c/Users/310145787/Desktop/mongo:/data/db mongo
i get a warning message inside the container saying:
WARNING: This file system is not supported.
After starting mongo shutsdown immediately.
Any hints or tips on how to solve this?
解决方案Apparently, according to this gist and Sev (
sevastos
), mongo doesn't support mounted volume through the VirtualBox shared folder:See mongoDB Productions Notes:
MongoDB requires a filesystem that supports
fsync()
on directories.
For example, HGFS and Virtual Box’s shared folders do not support this operation.the easiest solutions of all and a proper way for data persistance is Data Volumes:
Assuming you have a container that has VOLUME ["
/data
"]
# Create a data volume docker create -v /data --name yourData busybox true # and use docker run --volumes-from yourData ...
This isn't always ideal (but the following is for Mac, by Edward Chu (
chuyik
)):I don't think it's a good solution, because the data just moved to another container right?
But it still inside the container rather than local system(mac disk).I found another solution, that is to use sshfs to map data between boot2docker vm and your mac, which may be better since data is not stored inside linux container.
Create a directory to store data inside boot2docker:
boot2docker ssh mkdir -p /mnt/sda1/dev
Use sshfs to link boot2docker and mac:
echo tcuser | sshfs docker@localhost:/mnt/sda1/dev <your mac dir path> -p 2022 -o password_stdin
Run image with mongo installed:
docker run -v /mnt/sda1/dev:/data/db <mongodb-image> mongod
The corresponding boot2docker issue points out to docker issue 12590 ( Problem with -v shared folders in 1.6 #12590), which points to the work around of using double-slash.
using a double slash seems to work. I checked it locally and it works.
docker run -d -v //c/Users/marco/Desktop/data:/data <image name>
it also works with
docker run -v /$(pwd):/data
这篇关于Boot2Docker(在Windows上)运行Mongo与共享文件夹(不支持此文件系统)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!