4km3/docker-dnsmasq

`cname` not working

ntviet18 opened this issue · 4 comments

I have a service name 'service', it is discoverable in dnsmasq

/ # ping service
PING service (172.17.0.3): 56 data bytes
64 bytes from 172.17.0.3: seq=0 ttl=64 time=0.129 ms
^C
--- service ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.129/0.129/0.129 ms

However when I specify the hostname alias with

dnsmasq --cname=service.example.com,service

neither in /etc/dnsmasq.conf

cname=cname=service.example.com,service

And the result

ping service.example.com
ping: bad address 'service.example.com'

Does service come from an upstream DNS servers? CNAMEs only work for services from DHCP or defined in /etc/hosts. See https://github.com/imp/dnsmasq/blob/master/dnsmasq.conf.example#L646-L649.

service comes from docker dhcp pool. Both service and dnsmasq are defined as follow.

docker-compose.yml
---
version: 2
services:
  dnsmasq: 
    image: andyshinn/dnsmasq:2.78
    cap_add: 
       - NET_ADMIN
    entrypoint: ovpn_run --proto udp4
  service:
    image: postgres:9.4-alpine

I think it might be related to this issue. But I don't really understand how it will fit into my situation.

Still not sure what you are trying to accomplish... Just adding the service to Docker Compose doesn't make the CNAMes available in Docker DNS. Also, what is ovpn_run? That isn't part of this image...

Going to close this since it's old and there was no response. Feel free to reopen if you still need help.