1.Docker中apt-get update出现以下错误:
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:3 http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 InRelease
Temporary failure resolving 'repo.mongodb.org'
Err:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
解决方式:
在linux中修改
vim /etc/resolv.conf
追加
nameserver 8.8.8.8
重新启动网络服务
sudo service network-manager restart
重新启动docker
sudo systemctl restart docker
2.虚拟机挂机后,
远程连接mongodb 失败
解决:
重新启动网络服务
sudo service network-manager restart
重新启动docker
sudo systemctl restart docker
3.有的教程进行如下修改
设置 vim /etc/mongod.conf.orig
bindId=127.0.0.1改为bindIp=0.0.0.0
我进行前两步骤就实现了,远程访问
本文介绍了在Docker中遇到的apt-get update无法解析域名的错误,以及虚拟机重启后MongoDB远程连接失败的问题。解决方法包括修改Linux的resolv.conf文件,添加Google DNS,然后重启网络服务和Docker。对于MongoDB,只需修改配置文件bindIp为0.0.0.0,允许所有IP访问即可实现远程连接。
1326

被折叠的 条评论
为什么被折叠?



