4km3/docker-dnsmasq

docker-compose does not work

Closed this issue · 1 comments

`version: '3.3'

services:
dnsmasq:
image: jpillora/dnsmasq
container_name: dnsmasq
ports:
- 53:53
cap_add: ['all']`

and local using telnet 127.0.0.1 return
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

it is strange

Hello yelijun,

First of all, the image used in your docker-compose is not the one provided in our project.

With our image in place, and the correct capabilities, everything works as expected.

Let me detail the testing scenario:

docker-compose.yaml:

version: '3.7'

services:
 dnsmasq:
  image: 4km3/dnsmasq:2.85-r2
  container_name: dnsmasq
  ports:
  - '9053:53/udp'
  - '9053:53/tcp'
  cap_add: ['NET_ADMIN']

Here I am mapping the service to listen on 9053 only for testing purposes, in order to avoid possible conflicts with other resolvers that may already be running on your system.

With that compose up, you can check it works correctly by using any domain query tools, for example dig:

$ dig @127.0.0.1 -p 9053 google.com

; <<>> DiG 9.16.1-Ubuntu <<>> @127.0.0.1 -p 9053 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5740
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.   IN A

;; ANSWER SECTION:
google.com.  177 IN A 172.217.168.238

;; Query time: 0 msec
;; SERVER: 127.0.0.1#9053(127.0.0.1)
;; WHEN: Sat Jun 19 12:03:31 UTC 2021
;; MSG SIZE  rcvd: 55