Every so often I make changes to a DNS record, test it, find out it's wrong, fix it and still get the old response because of caching somewhere along the line. After it happened to me and a colleague during a launch of a new version of a website, I decided to address the issue. I wanted a way to test DNS quickly and easily (preferably locally on command line), for it to be lightweight, doesn't require changes to my existing setup and doesn't require learning new tools. I decided to create a Docker image that has its own DNS resolver and each new container from that image has a clean cache and doesn't depend on other DNS servers or is affected from their caching.
Usage
To create a new container:
docker run -it registry.shore.coil/resolver
Inside the container you have access to nslookup
, dig
and mail
for testing purposes. If you need to test new changes, exit
the container and create a new one with no cache.
If you want to run just a single command (like getting the MX record for shore.co.il
):
docker run registry.shore.co.il/resolver dig +short shore.co.il mx
How does it work
On launch, the container runs and uses its own DNS resolver (in this case NSD). This way the OS caching or upstream caching don't interferes with querying and every new container starts with an empty cache.