mongoimport Docker失败:连接到数据库服务器时出错:没有可访问的服务器 [英] mongoimport Docker Failed: error connecting to the db server: no reachable servers
本文介绍了mongoimport Docker失败:连接到数据库服务器时出错:没有可访问的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用MongoDB创建一个Docker容器并将数据导入其中.我尝试使用以下dockerfile:
I am trying to create a Docker container with MongoDB and import data into it. I have tried using the following dockerfile:
FROM mongo
# This will be created if it doesn't exist
WORKDIR /app/data/
# Copy dependency definitions
COPY mydata.csv .
ENTRYPOINT mongod
# Import data
RUN mongoimport --host=127.0.0.1 -d mydb -c reports --type csv --file mydata.csv --headerline
我收到以下错误:
Failed: error connecting to the db server: no reachable servers
有什么建议吗?谢谢!
推荐答案
尝试一下:
mongoimport --host 127.0.0.1 --port <specifyPort> -d mydb -c reports --type csv --file mydata.csv --headerline
这篇关于mongoimport Docker失败:连接到数据库服务器时出错:没有可访问的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文