Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

[dns] set hostname based on container name #750

Closed
rade opened this issue May 27, 2015 · 9 comments
Closed

[dns] set hostname based on container name #750

rade opened this issue May 27, 2015 · 9 comments

Comments

@rade
Copy link
Member

rade commented May 27, 2015

Instead of

weave run --name=foo -h foo.weave.local -ti ubuntu

it would be nice to be able to just write

weave run --name=foo -ti ubuntu

for the same effect.

at least when --with-dns is specified.

i.e. if no hostname is specified it should be set to <container-name>.<weavedns-domain>.

Gotcha: the weaveDNS domain can be overridden, so this should respect that. Which involves asking weaveDNS. Which may not be running yet, in which case we should just stick to weave.local.

@rade rade added the feature label May 27, 2015
@rade rade added this to the next milestone May 27, 2015
@rade
Copy link
Member Author

rade commented May 27, 2015

NB: this needs to work with the proxy too, i.e. when the proxy is configured with --with-dns, then

docker run --name=foo -ti ubuntu

should set the hostname as described above.

@peterbourgon
Copy link
Contributor

+1

@awh
Copy link
Contributor

awh commented Jun 10, 2015

at least when --with-dns is specified.

This is different from the behaviour obtained from -h <fqdn>, which works without --with-dns. Furthermore, it's a fair bit more complicated to implement, because DNS records are updated in many places other than weave run (e.g. weave start, weave launch-dns), and these would somehow have to find out whether the container was launched with --with-dns or not. I'm going to make the initial version follow the behaviour of -h - speak up if you disagree @rade

@rade
Copy link
Member Author

rade commented Jun 10, 2015

I disagree. We must not lose the ability to start named containers w/o weave setting the hostname.

What is wrong with just modifying dns_args to return a -h ... in the conditions specified?

@awh
Copy link
Contributor

awh commented Jun 10, 2015

What is wrong with just modifying dns_args to return a -h ... in the conditions specified?

I was hoping to avoid parsing the docker arguments upfront by altering with_container_fqdn to docker inspect the container and synthesise an FQDN according to the desired precedence. Given

I disagree

I'll follow your recommendation!

@paulbellamy
Copy link
Contributor

Side-effect to keep in mind is that --name=foo.bar will become foo.bar.weave.local.

@rade
Copy link
Member Author

rade commented Jun 10, 2015

I was hoping to avoid parsing the docker arguments upfront

dns_args is already doing exactly that.

@rade
Copy link
Member Author

rade commented Jun 10, 2015

and it needs to happen upfront because we cannot set the hostname after container creation time.

@awh
Copy link
Contributor

awh commented Jun 10, 2015

dns_args is already doing exactly that.

Very superficially. But I take your point.

and it needs to happen upfront because we cannot set the hostname after container creation time.

I misunderstood the requirement here - I thought you just wanted the record inserted into weaveDNS, not that you wanted the omission of the -h parameter overridden.

@rade rade closed this as completed in #890 Jun 11, 2015
rade added a commit that referenced this issue Jun 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants