Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect the domainname if set #19

Open
wzrdtales opened this issue Jan 28, 2016 · 9 comments
Open

Respect the domainname if set #19

wzrdtales opened this issue Jan 28, 2016 · 9 comments

Comments

@wzrdtales
Copy link

Currently the domainname is ignored, if the hostname should be resolvable as 'hostname.docker' one needs to set the hostname to 'hostname.docker' and the domainname to 'docker'.

Example config:

        "Hostname": "host",
        "Domainname": "docker",

Currently needed workaround:

        "Hostname": "host.docker",
        "Domainname": "docker",
@tilgovi
Copy link

tilgovi commented Feb 18, 2016

I don't think I understand fully. What configuration is this an example for?

@wzrdtales
Copy link
Author

Docker-compose https://docs.docker.com/compose/compose-file/

@tilgovi
Copy link

tilgovi commented Feb 18, 2016

Resolvable currently registers <name>.docker, not <hostname>.<domainname>.

What happens if you set the container name, rather than its hostname? The domain name option is not used by resolvable.

Two aliases are added by resolvable right now, <hostname> and <containername>.docker.

@tilgovi
Copy link

tilgovi commented Feb 18, 2016

While the compose docs do talk about domainname, I don't actually see a way to set that with docker run. Instead, it seems that "under the hood" this actually just concatenates them and sets the hostname for docker run to <hostname>.<domainname>.

It seems resolvable handles this naively right now, which enables your workaround. Resolvable adds the hostname as an alias without parsing it at all.

I'm actually a little confused why your workaround doesn't result in host.docker.docker being the alias. I'll have to look at the go docker client code to see why the hostname is only the short hostname.

@tilgovi
Copy link

tilgovi commented Feb 18, 2016

Alright, I just verified locally that resolvable only adds the short hostname, which is why your workaround functions.

Maybe it should add the full hostname of the container when it's started with one. That would resolve #20, too.

@wzrdtales
Copy link
Author

that would be an option, also to note that docker-compose does everything perfectly valid. The FQDN is always composed from hostname + domainname. It is also what I originally asked for, to also respect the domain name and use the FQDN or full hostname.

@wzrdtales
Copy link
Author

And about the confusion: docker-compose assumes: hosntame.domainname and automatically splits the hostname into those parts.

@wzrdtales
Copy link
Author

To give a bit of an insight also:

The reason I need the hostname is that we also use docker as development environment and there is a possibility that there are different versions of containers with the same hostname. Those containers should be reachable via the hostname and not every time through the new random container name.

The problem now raises here: We unfortunately also currently have proxies in place to access the internet, thus we need to set exceptions. The approach to solve this is to assume that all docker domains end on .docker and this is the actual exception for the proxy.

The problem is that the hostname is never added as hostname.docker as this happens to the containername, the result from all of this was the workaround posted above.

@lalyos
Copy link
Contributor

lalyos commented Feb 19, 2016

#22 implements fqdn names. You can even give it a try by using lalyos/resolvable:fqdn-ptr image. See #22 comments.

Just a quick note on docker-compose: you can specify fqdn names 2 ways:

hostname can include the full domainname:

web:
    image: nginx
    hostname: myweb.example.com

Or define separate hostname and domainname:

web:
    image: nginx
    hostname: myweb
    domainname: example.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants