我想玩超级账本结构,这需要Linux。 现在我想使用Windows,我的想法是安装带有WSL的Ubuntu,然后在其中进行开发。 当我想使用码头工人时,问题出现了。
我逐步按照本教程中的步骤进行操作,但遇到了一些问题。
filip@CSGN044D:~$ docker --version
Docker version 19.03.5, build 633a0ea838
filip@CSGN044D:~$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
filip@CSGN044D:~$ sudo service docker start
* Starting Docker: docker
再说一遍...
filip@CSGN044D:~$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
这可能吗?
看起来你的 Docker CLI 仍在尝试连接到本地 Unix 套接字而不是本地主机。确保DOCKER_HOST
环境变量设置为tcp://localhost:2375
尝试先将其设置在外壳中
export DOCKER_HOST=tcp://localhost:2375
健全性检查
echo $DOCKER_HOST
现在尝试运行所有常规的 Docker 命令。如果这些有效,请将其添加到您的.bashrc
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc
source ~/.bashrc
并不是说在教程中作者使用localhost:2375
而不是tcp://localhost:2375
.我认为您必须明确指定协议。此外,您的 shell 可能没有使用bash_profile
作为配置文件(通常 Mac shell 使用它(,因此请尝试将其添加到您的bashrc
中。