sudo systemctl restart docker
#进入容器
docker exec -it mymongo /bin/bash
#使用MongoDB客户端进行操作
mongo
# ERROR
[root@localhost ~]# sudo systemctl restart dock
Failed to restart dock.service: Unit not found.
[root@localhost ~]# docker exec -it mymongo /bin/bash
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
# 解决方法
[root@localhost ~]# systemctl restart docker
本文介绍了如何正确重启Docker服务及通过Docker进入MongoDB容器的方法。文章首先展示了使用错误命令导致的问题,并给出了正确的解决方案。
668

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



