Docker Community Forums

Share and learn in the Docker community.

Create public DNS record when creating a container using docker-compose

Hello forum,

This is my first post and i have a question.
I have a simple docker setup with one synology as my docker host. I am using the Traefik reverse proxy in combination with Let’s encrypt to host some applications for personal use.
When i create a container with docker-compose i can configure the reverse proxy using labels.
After the container has started, the labels will automaticly configure the reverse proxy and the reverse proxy will automatic request a SSL certificate using Let’s encrypt.
Let’s encrypt uses DNS challange and the proxy creates a DNS TXT record so Let’s encrypt can verify Domain ownership.

What i am looking for is a way to automatic create the Host A record and PTR record in DNS when creating a container using docker-compose. I hope there is an application that’s using labels (like the traefik reverse proxy)


Wouter Iliohan

For my homelab I did set the A record of * to my public ip. I let traefik create wildcard domain certificates. Making a new service available by dns becomes as simple as setting the host rule on the traefik label.

I haven’t seen a Docker equivalent of Kubernetes’s which in fact registeres dns entries for services. If you have some development experience, you could mimik the behavior of Traefik and listen to dockers event stream and whenever a service is started/stopped you could leverage the dns-api to register/unregister dns entries.

Best, very good information. Need to ask for advice