I thought what I was trying to do was simple, but can’t seem to find the right information.
All I want to do i start Grafana in a Docker container on Wiundows and access data from our MS SQL Server.
If I start the docker instance using the default, “docker run -d -p 3000:3000 --name grafana grafana/grafana”, then when I get to testing the addition of the MS SQL connection I get the error “lookup dbserver on 192.168.65.1:53: no such host”. I have no idea where the IP address 192.168.65.1 comes from.
If I start grafana specifying a ‘host’ network for docker rather than 'bridge;, i.e. “docker run -d --network host --name grafana grafana/grafana” (specifying “-p 3000:3000” gets a message saying the port mapping is being ignored) then I can’t even connect to grafana using http://localhost:3000 so can’t configure anything.
I’m sure this should be simple to configure since it must be a common configuration.
What do I need to do to get it set up?
Update: if I use the standard docker run command and add “–dns our_dns” then I get an error “lookup dbserver on our_dns:53: server misbehaving”.
Update: Tried specifying both --dns and --network. “netstat -a” still shows nothing listening on port 3000.
Docker port mapping with Grafana doesn’t work without some environment variables. Review this link. It is so tricky but I think that it is the only way to do that.
The items shown there all refer to paths within docker image. It’s not obvious what config item should be changed since, for example, the default port of 3000 should work but just gives an empty response.
I tried starting the docker image with
docker run -d -e "GF_HTTP_PORT=3000" --name grafana --dns my_dns --network host grafana/grafana
(where my_dns is the IP of one of our DNS servers).
I could then run bash in the docker image as root and do “apt update”, “apt install nettools”, “netstat -a”, from which it seems nothing is listening on port 3000!
Further “netstat -a | grep grafana” returns nothing, indicating, as far as I can tell, that the grafana_server isn’t listening on any port at all!
I can’t believe I’m the first person to try to use grafana inside a docker container on a host network! The should be a simple config setting to get it to listen on port 3000.
I also tried installing wget inside the docker image and doing “wget http://localhost:3000/” which returned an index.html file, so something is working, but port 3000 doesn’t seem to be accessible externally.
I decided one last attempt using:
docker rub -d -p 3000:3000 --name=grafana --dns <mydns> grafana/grafana
After then connecting as root and finding I could install the networking tools, I realised the error was in not specifying the fully qualified name of the MS SQL server!
Hope this helps stop someone else from wasting 4 hours trying to get things working!