[英]Docker host config has wrong IP address
I'm trying to install Docker on Raspbian but it seems to have picked up an old config from somewhere. 我正在尝试在Raspbian上安装Docker,但似乎已从某个地方获取了旧配置。 No idea where from, as I can't find any references anywhere. 不知道从哪里来,因为我在任何地方都找不到参考。
I have installed Docker on Raspbian using sudo apt-get install docker-ce
. 我已经使用sudo apt-get install docker-ce
在Raspbian上安装了Docker。
When I try to connect to Docker, it tries to connect to the wrong IP address (192.168.1.75 when it should be 192.168.1.227). 当我尝试连接到Docker时,它尝试连接到错误的IP地址(192.168.1.75,应为192.168.1.227)。
$ docker ps
error during connect: Get http://192.168.1.75:2376/v1.38/containers/json: dial tcp 192.168.1.75:2376: connect: no route to host
The server used to be on 192.168.1.75 but is now on 192.168.1.227. 所使用的服务器是在192.168.1.75,但现在是192.168.1.227。
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr b8:27:eb:50:b4:16
inet addr:192.168.1.227 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42704 errors:0 dropped:0 overruns:0 frame:0
TX packets:61093 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6278037 (5.9 MiB) TX bytes:80578119 (76.8 MiB)
I've tried rebooting the server, deleting the contents of the /var/run/docker
folder, and even reinstalling Docker. 我尝试过重启服务器,删除/var/run/docker
文件夹的内容,甚至重新安装Docker。 It's still determined that the IP address is 192.168.1.75. 仍然确定IP地址为192.168.1.75。
You can set the machine where the docker command tries to connect with the DOCKER_HOST environment variable: 您可以设置docker命令尝试与DOCKER_HOST环境变量连接的机器:
export DOCKER_HOST="tcp://192.168.1.227:2376" 导出DOCKER_HOST =“ tcp://192.168.1.227:2376”
But it's strange that you have to do this on a default installation, perhaps they is a DOCKER_HOST variable in you bash/zsh profile that cause this problem ? 但是很奇怪,您必须在默认安装上执行此操作,也许它们是您的bash / zsh配置文件中的DOCKER_HOST变量,导致此问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.