服务端
未映射端口,所以无法直接访问
docker run -d --name node1 -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -server -node=node1 -bootstrap-expect=2
JOIN_IP="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' node1)"
docker run -d --name node2 -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -server -node=node2 -join $JOIN_IP
docker run -d --name node3 -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -server -node=node3 -join $JOIN_IP
客户端
docker run -d --name node4 -p 8400:8400 -p 8500:8500 -p 8600:53/udp -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -ui -node=node4 -client=0.0.0.0 -join $JOIN_IP
网友评论