linux - robomongo 无法连接到 docker mongo 容器
问题描述
我在我的VPS上通过 docker 运行 mongo 映像。
sudo docker run --rm --name db -p 27017:27017 mongo
并尝试通过 robomongo 连接到 mongodb 实例,我在我的 mongo 实例中看到接受 robomongo 连接但 robomongo 无法连接并保持加载的连接日志。我ufw
的 is enable
and allow
ed for incoming
and outgoing
.
docker --version
是Docker version 19.03.13, build 4484c46d9d
当我尝试连接时,我得到了这个日志
{"t":{"$date":"2020-11-26T09:45:58.665+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"<REMOVED>:52954","connectionId":1,"connectionCount":1}}{"t":{"$date":"2020-11-26T09:45:58.667+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn1","msg":"client metadata","attr":{"remote":"<REMOVED>:52954","client":"conn1","doc":{"application":{"name":"robo3t"},"driver":{"name":"MongoDB Internal Client","version":"4.0.5-18-g7e327a9017"},"os":{"type":"Linux","name":"Ubuntu","architecture":"x86_64","version":"20.04"}}}}
它是我的sudo iptables -L -v
输出:
Chain INPUT (policy ACCEPT 63 packets, 4140 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
8 1024 DOCKER-USER all -- any any anywhere anywhere
8 1024 DOCKER-ISOLATION-STAGE-1 all -- any any anywhere anywhere
3 429 ACCEPT all -- any docker0 anywhere anywhere ctstate RELATED,ESTABLISHED
1 60 DOCKER all -- any docker0 anywhere anywhere
4 535 ACCEPT all -- docker0 !docker0 anywhere anywhere
0 0 ACCEPT all -- docker0 docker0 anywhere anywhere
0 0 ACCEPT all -- any docker_gwbridge anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 DOCKER all -- any docker_gwbridge anywhere anywhere
0 0 ACCEPT all -- docker_gwbridge !docker_gwbridge anywhere anywhere
0 0 ACCEPT all -- any br-28cff8103d27 anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 DOCKER all -- any br-28cff8103d27 anywhere anywhere
0 0 ACCEPT all -- br-28cff8103d27 !br-28cff8103d27 anywhere anywhere
0 0 ACCEPT all -- br-28cff8103d27 br-28cff8103d27 anywhere anywhere
0 0 DROP all -- docker_gwbridge docker_gwbridge anywhere anywhere
Chain OUTPUT (policy ACCEPT 51 packets, 8916 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (3 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
pkts bytes target prot opt in out source destination
4 535 DOCKER-ISOLATION-STAGE-2 all -- docker0 !docker0 anywhere anywhere
0 0 DOCKER-ISOLATION-STAGE-2 all -- docker_gwbridge !docker_gwbridge anywhere anywhere
0 0 DOCKER-ISOLATION-STAGE-2 all -- br-28cff8103d27 !br-28cff8103d27 anywhere anywhere
8 1024 RETURN all -- any any anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (3 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any docker0 anywhere anywhere
0 0 DROP all -- any docker_gwbridge anywhere anywhere
0 0 DROP all -- any br-28cff8103d27 anywhere anywhere
4 535 RETURN all -- any any anywhere anywhere
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
8 1024 RETURN all -- any any anywhere anywhere
解决方案
推荐阅读
- sql - SQL Server 代理在午夜删除记录
- swiftui - 点击文本以显示所有内容
- python - 向 hvplot.bar 添加值标签
- mongodb - 如何配置mongodb索引以在时间范围内按值排序?
- angular - Infragistics 主题无法按 *I* 预期工作。未应用默认主题
- asp.net-core - 在下拉菜单中选择多个条目时,多选下拉菜单搜索字符串结果
- loops - 为什么我的变量不“记住” if 语句中的更改?
- javascript - 使用对象 ID 的光线投射不起作用:threeJS
- javascript - 使用 Formik (React) 更新 Material-UI TextField onBlur
- vb.net - 使用 VB.net 在 SQLite 中导入 CSV