Set up DNS server with Docker
Preparation for self-testing (Optional)
- Change the DNS server to
127.0.0.1
.
For examaple:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
In this case, the <interface_name>
will be Wi-Fi
.
Therefore, the command should be:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
After changeing the DNS server to 127.0.0.1
, try to resolve www.google.com
and my.domain
. The expect result is that the address can't be resolved.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Set up a DNS server with Docker
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Our goal is set up a DNS server which can resolve the private domain namemy.domain
to 10.0.2.15
and also be able to resolve other public domain name.Background knowledges
- Docker: Know how to pull image and run container.
- Docker Compose: Know what the docker compose is and the dockercompose file format and how to trigger a service.
- Bind9: Just need to know it's DNS server is good enough.
- Bind9 in docker
- Config Bind9: At least go through this video
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Prepare needed configuration files
- Create a folder named
my_dns
.
- Create another folder named
config
under my_dns
.
- Create a file named
named.conf.options
with the contenet below:
- Create a file named
named.conf.local
with the contenet below:
- Create a file named
db.my.domain
with the contenet below:
Trigger the DNS service
Docker Compose
- Under the
my_dns
create a file named docker-compose.yml
.
- Under
my_dns
execute
If you don't want to see the log use:
Docker (Under WSL)
- Under the
my_dns
execute
or
If you don't want to see the log use:
or
Self-testing (Optional)
-
Make sure the DNS server is set to 127.0.0.1
.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
Try to resolve www.google.com
and my.domain
. The expect result is that the address can be resolved.

- After self-testing, you can reset the DNS setting to obtain automatically.