diff --git a/content/resolver.rst b/content/resolver.rst new file mode 100644 index 0000000000000000000000000000000000000000..cc404bab50bc1087c1783c90dcb0b80863679a6a --- /dev/null +++ b/content/resolver.rst @@ -0,0 +1,42 @@ +Testing DNS with a clean cache +############################## + +:date: 2016-11-01 +:summary: Testing DNS with a clean cache + +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: + +.. code:: shell + + docker run -it adarnimrod/resolver + +Inside the container you have access to :code:`nslookup`, :code:`dig` and +:code:`mail` for testing purposes. If you need to test new changes, +:code:`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 +:code:`shore.co.il`): + +.. code:: shell + + docker run adarnimrod/resovler 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 interferes with querying and every +new container starts with a clean slate.