Bind Named DNS - Flush DNS cache on Docker

by
Jeremy Canfield |
Updated: October 09 2021
| Bind Named DNS articles
This assumes you have installed Bind on Docker, and that Bind is up and running.
The rndc dump -cache command can be used to create a file of the current DNS cache.
docker exec bind rndc dumpdb -cache
This will create a file named named_dump.db in the "directory" defined in your named.conf.options file, which is /var/cache/bind by default.
options {
directory "/var/cache/bind";
dnssec-validation auto;
listen-on-v6 { any; };
};
The dump file should contain A records like this.
www.google.com. 604693 A 142.250.190.36
You can then issue these commands to flush the DNS cache.
~]# docker exec bind rndc flush
~]# docker exec bind rndc reload
server reload successful
You would then remove the old cache_dump.db file, generate a new cache_dump.db file, and there should be no A records in the newly created cache_dump.db file.
docker exec bind rm /var/cache/bind/cache_dump.db
docker exec bind rndc dumpdb -cache
Did you find this article helpful?
If so, consider buying me a coffee over at