简体   繁体   English

如何使用mongodb从计算机导入文件到docker容器

[英]How import file from computer to docker containers with mongodb

I have a problem with my docker container. 我的docker容器有问题。 I need to import data, something like .csv file from my computer to docker container, but I don't know how. 我需要将数据,例如.csv文件从我的计算机导入到docker容器,但我不知道如何。 I found a command like "docker insert" but it doesn't work. 我发现了一个像“docker insert”这样的命令,但它不起作用。

You can do this using Docker volumes. 您可以使用Docker卷执行此操作。

docker run -i -t -v /home/user/stuff:/data ubuntu /bin/bash

Where in this example /home/user/stuff is a directory OUTSIDE the container and /data is the directory where that content will be located INSIDE the container. 在这个例子中/ home / user / stuff是一个目录OUTSIDE容器和/ data是该内容将位于容器内的目录。

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

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