As far as I know, Docker does not provide this function out of the box. But, of course, there are several workarounds here. In fact, you need to deploy DNS on your host, which will distinguish between containers and resolve domain names in dynamic IP addresses. So you can try:
- Deploy some DNS solutions that support Docker (I suggest you use
SkyDNSv1 / SkyDock ); - Configure your host to work with this DNS (by default,
SkyDNS makes containers know each other by name, but the host does not know about it); - Launch your containers with an explicit
--hostname (you will probably use the container_name.image_name.dev.skydns.local schema).
You can skip step # 2 and launch the browser inside the container: it will detect the web application container by host name.
source share