Docker network interface interferes with mDNS address

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:

  1. ping <hostname>.local starts returning unknown host
  2. The advertised address (the one that other machines on the same network see when they try to ping <hostname> resolves to 192.168.254.1.

The only way to fix this (temporarily), is to:

  1. Stop docker daemon
  2. Restart avahi daemon
  3. 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?

@olshansky I know this is a few years old, but was wondering if you were ever successful? Thanks!

Hey, this was a long time ago, and the project was closed-sourced so, unfortunately, there’s nothing we can reference.

I don’t have enough context regarding your specific problem but what you probably want to look into is port binding and having all your containers communicate through your host.

As a bonus, I also you recommend out this short post I wrote a while ago about locally hot reloading while working from within a docker container.