CentOS7 中的 Python 3.6.3 虚拟环境问题 - “错误:无法连接到 Docker(它正在运行吗?)”

CentOS7 中的 Python 3.6.3 虚拟环境问题 - “错误:无法连接到 Docker(它正在运行吗?)”

我的 CentOS7 VM 中有一个虚拟环境问题:

Checking for virtualenv...
Activating virtual environment /home/crimson/venv/python3
/home/crimson/venv/python3/myvra.json matches /home/crimson/venv/myvra.json
/home/crimson/venv/python3/myvrni.json matches /home/crimson/venv/myvrni.json
Error: Could not connect to Docker (is it running?)
crimson@CentOS-7:~/bin$

Python以下是我的和检查的输出pip

crimson@CentOS-7:~/bin$ python --version
Python 3.6.3
crimson@CentOS-7:~/bin$ pip --version
pip 19.3.1 from /home/crimson/venv/python3/lib/python3.6/site-packages/pip (python 3.6)

Docker 正在运行,当我测试它时docker run hello-world它按预期工作:

    crimson@CentOS-7:~/bin$ service docker status
    Redirecting to /bin/systemctl status docker.service
    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
       Active: active (running) since Tue 2019-10-29 21:00:44 MDT; 7min ago
         Docs: http://docs.docker.com
     Main PID: 1180 (dockerd-current)
       CGroup: /system.slice/docker.service
               ├─1180 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --def...
               └─1251 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.soc...

 Container Engine.
    Hint: Some lines were ellipsized, use -l to show in full.
    crimson@CentOS-7:~/bin$
    crimson@CentOS-7:~/bin$ docker run hello-world

    Hello from Docker!
    This message shows that your installation appears to be working correctly.

更新:我今天没有遇到这个问题!我昨天在家工作,这肯定是问题的关键——某种网络差异当我不在办公室时,这会阻止我的 Docker 映像运行.....但我不知道它是什么。 

更新 2:这是因为我在家工作时遇到某种网络差异:VPN 客户端没有我在办公室使用笔记本电脑时拥有的相同资源。遗憾的是,我无法修复此问题。

答案1

当我不运行 docker 时,我自己也遇到过问题sudo。我不知道你到底在运行什么,但它可能看起来像下面的项目:

sudo docker run [thing you want to run]

sudo [docker command you're running]

相关内容