I’m running Docker 1.12.1. Got a few containers on a user-network (bridge type), each container assigned a --network-alias. Containers resolve each other correctly, but the host is just simply not able to resolve any container by its network alias or host name.
How can one make the host to be able to resolve names of containers on a any user network? Thanks!
Since this question does not receive enough attention, I assume that it is in feasible or just very hard to accomplish in contrast to how natural the requirement is.
Don’t believe the network aliases have any effect for host -> container connections. It’s just another alias accessible via DNS from containers inside the specificed bridge network. Or you could map a port and then just connect to it via localhost:<mapped_port>.
You could achieve what you want by putting an entry into your host’s /etc/hosts file mapping your alias to the IP address of the container (accessed via docker inspect <container>)
Yes, this is what I have right now, but unfortunately managing tens of containers statically like that is not a convenient way of doing this. Is there any way to access the embedded DNS on a user defined network maybe? It could work. I see all the containers go for 127.0.0.55, but is that accessible from the host?
ping nginx.dev.intranet
PING nginx.dev.intranet (172.17.0.5) 56(84) bytes of data.
64 bytes from 172.17.0.5: icmp_seq=1 ttl=64 time=0.099 ms
64 bytes from 172.17.0.5: icmp_seq=2 ttl=64 time=0.069 ms