Ever since I installed docker on my Ubuntu machine, I've been having problems with the mDNS address it advertises.
In order for me to ssh into my box without knowing the ip, I need to use <hostname>.local
, which I need to have resolved to the eth0 interface. This was working up up until I configured docker.
I set /etc/docker/daemon.json to:
{
"bip": "192.168.254.1/24"
}
I start the docker daemon via the following simple command: sudo service docker start
. I confirmed that the appropriate docker bridge (interface docker0) and that the firewall (ip tables) are as expected. All my services are communicating with each other as expected.
When I run ifconfig
, I see that docker0
advertises 192.168.254.1
and eth0
advertises 10.14.146.62
.
When I ping ping <hostname>.local
from within my ubuntu machine, it resolves to 10.14.146.62
. Same thing goes for other machines on the same network.
However, after some time (30 minutes), the following happens:
ping <hostname>.local
starts returning unknown host- The advertised address (the one that other machines on the same network see when they try to ping
<hostname>
resolves to192.168.254.1
.
The only way to fix this (temporarily), is to:
- Stop docker daemon
- Restart avahi daemon
- Start docker daemon
This returns me to the state where <hostname>.local
resolves to 10.14.146.62
both internally and externally for some time.
I have tried modifying /etc/avahi/avahi-daemon.conf
to include the following without any successfull results:
allow-interfaces=eth0
deny-interfaces=docker0
I considered setting iptables=false
in the docker configs, but I need my services to be reached externally.
Searching online led me to various solutions ranging from docker, firewall or avahi issues/configs. However, nothing has resulted in successful results yet. Any suggestions?