我正在使用docker来部署一个zookeeper集合,并且我遇到了一个问题,我认为这是由于代理docker用于localhost。
编辑:问题是当我关闭连接时,它们会被留在TIME_WAIT
中我想将我的容器的ip更改为私有地址空间中的其他内容。 192.168.0.0子网,看看这是否解决了这个问题。
非常感谢任何指导
这是我目前的docker-compose.yml的一部分:
version: '2'
services:
zoo1:
image: zookeeper
restart: always
ports:
- 2181:2181
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 server.4=zoo4:2888:3888 server.5=zoo5:2888:3888
zoo2:
image: zookeeper
restart: always
ports:
- 2182:2181
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 server.4=zoo4:2888:3888 server.5=zoo5:2888:3888
答案 0 :(得分:1)
From the docker documentation, when you start the docker daemon, you can pass the following parameters:
--bip=CIDR: supply a specific IP address and netmask for the docker0 bridge, using standard CIDR notation. For example: 192.168.1.5/24.
--fixed-cidr=CIDR and --fixed-cidr-v6=CIDRv6: restrict the IP range from the docker0 subnet, using standard CIDR notation. For example: 172.16.1.0/28. This range must be an IPv4 range for fixed IPs, such as 10.20.0.0/16, and must be a subset of the bridge IP range (docker0 or set using --bridge). For example, with --fixed-cidr=192.168.1.0/25, IPs for your containers will be chosen from the first half of addresses included in the 192.168.1.0/24 subnet.