Docker Community Forums

Share and learn in the Docker community.

Can we setup separate DNS name for each container based on port no.?

Can we setup Separate DNS names for each container running on the Same Machine with different port No?
for example: -> ->

Needs further/better explaination :thinking:

Since your label says “aws”, I assume your domain is hosted on route53. Use an ALB, per domain add a rule that matches the FQDN and forwards to a specific target group,which points to the ec2 machine and the publised container port.

Though, this seems to be a question about what needs to be done in AWS, rather then a docker question.

How to run multiple containers on a single host machine(123.564.789.564) and access the applications running on containers with dns NAME?

EX: docker run -d -p 8081:80 --name webserver nginx
dcoker run -d -p 8085:8080 --name appserver tomcat7
Now both the containers are running on the same host machine, now how to access them with dns names instead of ip:portno??