How to Use Dnsdock Within Docker-Compose?

I was trying to use dnsdock to link containers inside docker-compose environment.

dnsdock:
    image: tonistiigi/dnsdock
    volumes:
        - /var/run/docker.sock:/run/docker.sock
    ports:
        - 172.17.42.1:53:53/udp

pinger1:
  image: gliderlabs/alpine
  command: ping pinger2.pinger2.docker
  dns: 172.17.42.1
  environment:
   - DNSDOCK_NAME=pinger1
   - DNSDOCK_IMAGE=pinger1

pinger2:
  image: gliderlabs/alpine
  command: ping pinger1.pinger1.docker
  dns: 172.17.42.1
  environment:
   - DNSDOCK_NAME=pinger2
   - DNSDOCK_IMAGE=pinger2

And got the next issue during starting up:

ERROR: Cannot start container 7cebbcde6c7ae85faaefd655aeb18a53710588c930888e15bdeb3c7392bda027: failed to create endpoint docker_dnsdock_1 on network bridge: Error starting userland proxy: listen udp 172.17.42.1:53: bind: cannot assign requested address

Running with simple command: sudo docker-compose -f dnsdock-test.yml up

Maybe someone knows what is the problem with config ?

1

1 Answer

Works for me after replacing ip with 172.17.0.1 instead of 172.17.42.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest