Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

DNS override for the CPM


Network options set in docker run commands, are not inherited by the CPM runner containers which are spawned separately from the CPM to perform browser and scripted monitor checks. More on this here:

Additionally /etc/hosts will not be automatically copied over to containers by Docker as one would expect for resolv.conf, so any IP mapping configured there will not be honored, but that being said if you have nameservers to provide to /etc/resolv.conf should be present.

If your use case requires overriding dns resolution, or manually mapping IPs to hostnames, dnsmasq is handy for this sort of thing. This example is tested on Ubuntu 18.04, here are some instructions to get started:

Install dnsmasq:

apt-get update
apt-get install dnsmasq

Edit /etc/dnsmasq.conf

add the lines:

#have dnsmasq listen to the docker network interface, you can see this interface running `ifconfig`

#bind our hostname to an address

restart dnsmasq

sudo /etc/init.d/dnsmasq restart

By default, dns requests on localhost will pass through dnsmasq, now we also have dns requests that pass through the docker0 interface also use our dnsmasq rules. Since the host loop back interface is not available in a container we can now leverage the docker0 interface.

Get the inet IP of the docker0 running ifconfig . You may see output like this:

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast

To test our configuration run nslookup localhost and nslookup (you may need to restart docker for the 2nd one)

Next you’ll want to configure the docker daemon to use the docker0 IP for DNS. This can be done by creating the file /etc/docker/daemon.json and providing the following json:


Then restart the docker daemon:

sudo systemctl restart docker

Now start the CPM and give it a test.