Problem: When I run consul in a docker container on Windows, nslookup fails.
Example:
nslookup -port=8600 consul.service.consul 127.0.0.1
Server: UnKnown
Address: 127.0.0.1
*** UnKnown can't find consul.service.consul: No response from server
However, if I run the same command from a debian container with host networking on the same docker host, it works fine. Example:
docker run -it --rm --net=host debian /bin/bash
...
apt-get update && apt-get install -y dnsutils
...
nslookup -port=8600 consul.service.consul 127.0.0.1
Server: 127.0.0.1
Address: 127.0.0.1#8600
Name: consul.service.consul
Address: 127.0.0.1
I’m a bit stumped as to why nslookup fails on the Windows docker host, but succeeds in a host networked container. I’m trying to figure out if this is an issue with my configuration, not running the correct command on Windows, docker on Windows shenanigans, etc. FWIW, I can access the UI on http://127.0.0.1:8500 just fine.
Command I used to create the container:
docker run `
--name=consul-server `
-v "C:/Consul/Consul.d:/consul/config" `
-v "C:/Consul/Data_dir:/consul/data" `
-p 8300:8300 `
-p 8301:8301 `
-p 8302:8302 `
-p 8500:8500 `
-p 8501:8501 `
-p 8600:8600/tcp `
-p 8600:8600/udp `
consul:1.10.2 `
agent -server
My config:
{
"data_dir": "/consul/data",
"client_addr": "0.0.0.0",
"bind_addr": "127.0.0.1",
"retry_join": ["127.0.0.1"],
"datacenter": "ag-dev",
"log_rotate_max_files": 29,
"server": true,
"bootstrap_expect": 1,
"ui": true
}