aacebedo / dnsdock

DNS service discovery for Docker containers
MIT License
606 stars 91 forks source link

Docker match format as template #101

Closed julianxhokaxhiu closed 7 years ago

julianxhokaxhiu commented 7 years ago

Hi,

I would like to use this DNS for my Stack, although what I currently miss is the possibility to customize the template on how the entry will be added to the DNS.

For example from:

<anything>.<container-name>.<image-name>.<environment>.<domain>

I just need

<container-name>.<domain>

A logical implementation may be that you fill in information by replacing token. Depending on the way the token are concatenated, the entry will be shaped.

Would be nice if it's possible to configure this through an ENV variable when running this as a Docker and/or as a command line argument ( something like --template="<container-name>.<domain>" ).

Thank you in advance, Julian

julianxhokaxhiu commented 7 years ago

Although would be nice to have as a feature, for now I can workaround it by setting the LABEL com.dnsdock.alias for every container I am interested.

Better than nothing for now :) But still would be nice to have this issue solved via the template.

julianxhokaxhiu commented 7 years ago

Found this undocumented flag: https://github.com/aacebedo/dnsdock/blob/master/src/core/cmdline.go#L46

By using it, you automatically create an alias, using only the name flag, during docker run. Eg.

$ docker run --name my-awesome-docker ...

Therefore the template is no more needed, as this is handled automatically.