0

How do I assign DNS names directly to my Docker containers? This is a fairly broad question so as to avoid an X/Y problem - I'll try to explain what I've done but feel free to suggest another path.

Right now my idea is to create DNS names in my resolver, and route those to an IP dedicated to each container. Many containers will have overlapping ports, so I have been attempting to use the macvlan driver to assign them separate IP addresses. These are attached to network interface just for containers. Some of my efforts are shown in this Reddit thread - but so far, I have not been successful in routing either in or out of the container when using macvlan.

Is there a recommended way of just having one Docker host, with multiple services on port 80/443 (or other common ports) routed out to one.example.com, two.example.com etc?

2
  • OK, I think I see where you're going. AFAIK most people still use a web proxy container such as jwilder/nginx-proxy and don't bother with unique external IP addresses or macvlan. – Michael Hampton Sep 23 '19 at 19:51
  • I see. I'll try nginx-proxy and see how it works. Very much a different approach to macvlan but looks promising. – gjsmo Sep 24 '19 at 14:38
0

After some further investigation, I have discovered a solution to this issue. Specifically, I was using an older guide to macvlan, which fails to mention that promiscuous mode must be enabled on your network adapter. The latest guide does mention this. As it turns out, this solves my problem perfectly - any and all services get their own IP, which I can then assign to a DNS entry in my resolver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.