colinmollenhour / mariadb-galera-swarm

MariaDb Galera Cluster container based on official mariadb image which can auto-bootstrap and recover cluster state.
https://hub.docker.com/r/colinmollenhour/mariadb-galera-swarm
Apache License 2.0
217 stars 103 forks source link

Fixed ip address lookup for eth0 #8

Closed mayask closed 7 years ago

mayask commented 7 years ago

ip addr show eth0 output sometimes contains several ip addresses

root@d9592ddc3f54:/# ip addr show eth0                                                             
2759: eth0@if2760: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default 
    link/ether 02:42:0a:00:00:05 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.0.0.5/24 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.0.0.4/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:aff:fe00:5/64 scope link 
       valid_lft forever preferred_lft forever

and the start.sh script incorrectly parses them

root@d9592ddc3f54:/# ip addr | awk '/inet/ && /eth0/{sub(/\/.*$/,"",$2); print $2}'
10.0.0.5
10.0.0.4

The PR fixes it by taking the first ip address from the output.

mayask commented 7 years ago

I just noticed specifying NODE_ADDRESS=eth0 solves the issue, but anyway.

colinmollenhour commented 7 years ago

Thanks, this is related to #4, which I don't see a great solution for so I guess if it works to use the first IP then we'll go with it until it is shown to not work..