gpt4 book ai didi

mongodb - 在共享文件夹下运行Mongo的Boot2Docker(在Windows上)(不支持此文件系统)

转载 作者:行者123 更新时间:2023-12-02 18:43:49 27 4
gpt4 key购买 nike

我正在尝试使用Boot2Docker在Windows上使用共享文件夹来启动Mongo容器。开始使用run -it -v /c/Users/310145787/Desktop/mongo:/data/db mongo时,我在容器内收到一条警告消息,内容为:
WARNING: This file system is not supported.
启动mongo后立即关闭。

有关如何解决此问题的任何提示或技巧?

最佳答案

显然,according to this gistSev ( sevastos ),mongo不支持通过VirtualBox共享文件夹安装卷:

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 ...

这并不总是理想的(但以下是适用于Mac的 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

corresponding boot2docker issue指向 docker issue 12590 ( Problem with -v shared folders in 1.6 #12590),它使用双斜线指向 的解决方法。

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

关于mongodb - 在共享文件夹下运行Mongo的Boot2Docker(在Windows上)(不支持此文件系统),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29818433/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com