Open wzrdtales opened 8 years ago
I don't think I understand fully. What configuration is this an example for?
Docker-compose https://docs.docker.com/compose/compose-file/
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
.
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.
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.
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.
And about the confusion: docker-compose assumes: hosntame.domainname and automatically splits the hostname into those parts.
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/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
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:
Currently needed workaround: