kevinjqiu / coredns-dockerdiscovery

Docker Discovery Plugin for CoreDNS
Apache License 2.0
62 stars 29 forks source link

Add directive to define domain for container name #8

Closed sashaaro closed 5 years ago

sashaaro commented 5 years ago

Container name is required indicator. Will be convenient to have access by container name as subdomain. I rename domain directive to hostname_domain. domain work as domain for container's names

kevinjqiu commented 5 years ago

Hey @sashaaro I don't quite understand this change. Is there a case where hostname_domain and domain would be set differently? Could you give an example where both are configured, and when a container is launched, what DNS names would it get?

Thanks!

sashaaro commented 5 years ago

For example from https://www.portainer.io/installation/ .

docker unix:///var/run/docker.sock {
    domain docker.loc
}

docker run -d --name my-portainer portainer/portainer

Would be resolved by my-portainer.docker.loc It is mean every container can be resolved by same rule with his name (most right column in picture bottom). If you didn't specify name to container, docker assign random name. image text

Same for hostname_domain directive but it use --hostname instead of --name for subdomin. Work as domain before

docker unix:///var/run/docker.sock {
    hostname_domain docker-host.loc
}

docker run -d --hostname my-portainer portainer/portainer

Would be resolved by my-portainer.docker-host.loc

It is not clearly from readme file?!

kevinjqiu commented 5 years ago

Thanks for the explanation.

It is not clearly from readme file?!

No need to be abrasive here.

sashaaro commented 5 years ago

Want to readme would be clear for everyone