sameersbn / docker-bind

Dockerize BIND DNS server with webmin for DNS administration
MIT License
913 stars 333 forks source link

listen tcp 0.0.0.0:53: bind: address already in use #65

Closed selleronom closed 5 years ago

selleronom commented 5 years ago

Posting my solution to the error below:

ERROR: for 515f8b2ecd33_docker-bind_bind_1 Cannot start service bind: b'driver failed programming external connectivity on endpoint docker-bind_bind_1 (bc8836ceccc907c7ad0610e941b533c68f250c56cffcd4646e9171e7a330c9b3): Error starting userland proxy: listen tcp 0.0.0.0:53: bind: address already in use'

ERROR: for bind Cannot start service bind: b'driver failed programming external connectivity on endpoint docker-bind_bind_1 (bc8836ceccc907c7ad0610e941b533c68f250c56cffcd4646e9171e7a330c9b3): Error starting userland proxy: listen tcp 0.0.0.0:53: bind: address already in use'

SOLUTION: sudo systemctl stop systemd-resolved sudo systemctl disable systemd-resolved

YouSysAdmin commented 5 years ago
ports:
    - "<YOU-EXTERNAL-IP>:53:53/udp"
    - "<YOU-EXTERNAL-IP>:53:53/tcp"
    - "10000:10000/tcp"
    volumes:
- /srv/docker/bind:/data
selleronom commented 5 years ago

had trouble listening on IPv6 when specifying the external IP

NekoMajo commented 5 years ago

thank you very much for the solution posted above

SOLUTION: sudo systemctl stop systemd-resolved sudo systemctl disable systemd-resolved

pnelsonsr commented 5 years ago

I ran into this upgrading Fedora 29 to Fedora 30. I saw a similar error message and went looking for what service was holding on to port :53. I used fuser 53/udp which told me what process and then I just ps -ef that process to see that systemd-resolved was the service holding 53. Then I did the systemctl stop systemd-resolved and also disabled it. Great everything back to normal.

So my question is the above solution just a workaround or should I be doing something else now that I know of it?

snspinn commented 5 years ago

So my question is the above solution just a workaround or should I be doing something else now that I know of it?

So I was getting the error sudo: unable to resolve host ubuntu: Resource temporarily unavailable after stopping systemd-resolved. Not good.

Disabling systemd-resolved is avoidable with the solution presented by @SysAlex with one minor clarification:

ports:
    - "<EXTERNAL-OR-LOCAL-IP>:53:53/udp"
    - "<EXTERNAL-OR-LOCAL-IP>:53:53/tcp"
    - "10000:10000/tcp"
    volumes:
- /srv/docker/bind:/data

When I say 'local', I mean the "eth0/ enp(blah)/ wlan0's" of your machine. This does not clash with systemd-resolved.

P.s. I also included the following line in the docker-compose. May be worth testing.: dns: <LOCAL-IP>

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

PabloVirgolini commented 4 years ago

ports:

  • ":53:53/udp"
  • ":53:53/tcp"
  • "10000:10000/tcp" volumes:
    • /srv/docker/bind:/data
      
      When I say 'local', I mean the "eth0/ enp(blah)/ wlan0's" of your machine.
      This does not clash with systemd-resolved.

P.s. I also included the following line in the docker-compose. May be worth testing.: dns: <LOCAL-IP>

So, could you share your d-compose? I'm still having binding issues:

This was before asigning the Local IP of a Desktop:

ERROR: for 3bd5e52f4127_pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (521ba335446160637401223b6fa24f9f8707d493df827e693ad6ff1a9cf85e65): Error starting userland proxy: listen tcp 192.168.0.100:53: bind: cannot assign requested address

ERROR: for pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (521ba335446160637401223b6fa24f9f8707d493df827e693ad6ff1a9cf85e65): Error starting userland proxy: listen tcp 192.168.0.100:53: bind: cannot assign requested address

This was after making the changes: ERROR: for 3bd5e52f4127_pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (521ba335446160637401223b6fa24f9f8707d493df827e693ad6ff1a9cf85e65): Error starting userland proxy: listen tcp 192.168.0.100:53: bind: cannot assign requested address

ERROR: for pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (521ba335446160637401223b6fa24f9f8707d493df827e693ad6ff1a9cf85e65): Error starting userland proxy: listen tcp 192.168.0.100:53: bind: cannot assign requested address

noel-jackson commented 4 years ago

Bind uses port 53, pihole uses port 53. Doesn't work together like that. You need two separate IPs.

guysoft commented 3 years ago

If I disable systemd-resolved then the port is indeed not in use, but then my DNS does not work on the device - is there a way to solve that? Should I add somewhere a DNS server to pull and cache from it?

odedrich commented 3 years ago

docker-compose on ubuntu 20.04 LTS, leaving systemd-resolved enabled

version: "3"

More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/

services: pihole: container_name: pihole image: pihole/pihole:latest ports:

  • "192.168.1.59:53:53/tcp"
  • "192.168.1.59:53:53/udp"
  • "67:67/udp"
  • "80:80/tcp"
  • "443:443/tcp" environment: TZ: 'Europe/Brussels' WEBPASSWORD: 'xxxxx'

    Volumes store your data between container upgrades

    volumes:

  • ~/docker/pihole/etc-pihole/:/etc/pihole/
  • ~/docker/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/

    Recommended but not required (DHCP needs NET_ADMIN)

    https://github.com/pi-hole/docker-pi-hole#note-on-capabilities

    cap_add:

  • NET_ADMIN restart: unless-stopped
islamux commented 3 years ago

docker-compose on ubuntu 20.04 LTS, leaving systemd-resolved enabled

version: "3"

More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/

services: pihole: container_name: pihole image: pihole/pihole:latest ports:

  • "192.168.1.59:53:53/tcp"
  • "192.168.1.59:53:53/udp"
  • "67:67/udp"
  • "80:80/tcp"
  • "443:443/tcp" environment: TZ: 'Europe/Brussels' WEBPASSWORD: 'xxxxx'

    Volumes store your data between container upgrades

    volumes:

  • ~/docker/pihole/etc-pihole/:/etc/pihole/
  • ~/docker/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/

    Recommended but not required (DHCP needs NET_ADMIN)

    https://github.com/pi-hole/docker-pi-hole#note-on-capabilities

    cap_add:

  • NET_ADMIN restart: unless-stopped

Thanks a lot. This solution "10 is my ip"

shrimpwagon commented 3 years ago

I just solved this using rc.local without major system modifications:

https://serverfault.com/a/1050501/42819

PMach17 commented 3 months ago

Thanks for the solution!