4km3/docker-dnsmasq

Port 53 already in use (Ubuntu 16.04.1 LTS)

Closed this issue · 7 comments

Hi,

I've been trying to get this image to work on my laptop (Ubuntu 16.04.1 LTS) but I get the following error:

ERROR: for dnsmasq  Cannot start service dnsmasq: driver failed programming external connectivity on endpoint development_dnsmasq_1 (d6b0d37db7ab3d9c4caf681dbfb6514d424e8562e7f75cc1de079500a51a04d0): Error starting userland proxy: listen tcp 0.0.0.0:53: bind: address already in use
ERROR: Encountered errors while bringing up the project.

The output for netstat -tulpn| grep 53 says that I have a proces listening on TCP and running on UDP, both for port 53:

tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      3607/dnsmasq    
udp        0      0 127.0.1.1:53            0.0.0.0:*                           3607/dnsmasq    

Which is dnsmasq-base, a default package on ubuntu system.

I was wondering how others got to work around this without deinstalling the dnsmasq-base package from their ubuntu system ? I did some websearching and found I could use some proxy and/or should remove the package, but I don't want to. So hopefully someone here could help me out ?

Many thanks in advance.

Thank you @jwulf but I don't see how this applies to my issue?
I'm not looking for (re)starting/stopping the service, I am looking for a way to make them work together.
As I do not know what the consequences are of disabling this service on my laptop I really don't think it's okay just to deactive it.

Do you need the dnsmasq container running to server 127.0.1.1:53? It looks like the default Ubuntu dnsmasq is bound specifically to the loopback interface. Could you do something like specify the specific IP address of the host for the container to listen on (such as -p <ip>:53/tcp -p <ip>:53/udp)?

yeah that might work pretty well, make the dnsmasq server listen on 172.17.0.1.
Ill try that later on, will report back if it works.

So I've tried the following inside my docker-compose file:

  dns:
    image: andyshinn/dnsmasq:2.76
    cap_drop:
      - NET_ADMIN
    ports:
      - 172.17.0.1:53:53/tcp
      - 172.17.0.1:53:53/udp

But the docker container just exits immediately. I have not found out why.

Edit: same goes for 127.0.0.1

OK, that is separate from the port in use issue. That could be related to http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2014q2/008540.html. You need NET_ADMIN to do DHCP stuff with dnsmasq and may also need the dhcp-broadcast option.

Going to close this as the original issue didn't seem like it was part of this image but a port clashing issue. Let me know if there is still a problem being experienced.