<p><strong>Basics</strong>
Nginx is a webserver that can be used as a reverse proxy. I would suggest having a look at the nginx.conf file, where you can configure DNS redirects accordingly.</p>
<p><strong>Host</strong>
Nginx on host means you would need a port mapping( host -&gt; docker container) of all the docker containers in order to redirect traffic to the correct container. Wouldn't suggest this.</p>
<p><strong>Docker</strong>
Nginx on docker on same docker network would be my suggested approach: you can use docker DNS and only map the nginx server itself(ports 80/443).</p>
<p>Maybe a tool based on nginx would help here, which already has lets encrypt support: <a href="https://nginxproxymanager.com/" rel="nofollow noreferrer">https://nginxproxymanager.com/</a></p>

CC BY-SA 4.0
2022-12-09T10:15:50.827Z
2022-12-09T10:15:50.827Z
Vlad
<p>I guess you want to join the host to a (e.g. windows-) domain and then use this membership of the host in the containers instead of joining the containers themselves to the domain.</p>
<p>I guess that would heavily depend on the container because at least in red hat linux you use realm and SSSD to manage all the necessary processes. You would need to have that in the container and then map all the necessary files for all services. That would be a lot of stuff and i am not sure if it would work.</p>
<p>Another problem, if you have more than one container you map the domain to, would be that you have more than one (virtual) host pose as one to the domain. I guess that does not work with kerberos because they would get in the way of each other when exchanging tickets.</p>
<p>It is probably better to join the containers themselves to the domain. But you would need to have some clever way to pass the admin password into that process or it can not be automated.</p>

CC BY-SA 4.0
2024-06-26T07:19:49.257Z
2024-06-26T07:23:52.403Z
2024-06-26T07:23:52.403Z
zaphod
<p>I have a Redhat Linux server. In that, I installed docker and run docker containers in it. Now I want to map a domain to docker containers by using Nginx.</p>
<p>What is the correct process to map domains by using Nginx, install Nginx as a container or Install Nginx in the Host server? Any references?</p>

CC BY-SA 4.0
2022-12-06T08:55:13.203Z
With, uh, DNS? this question makes no sense as presented.
Chris Becke
<docker><docker-compose><nginx>
How can I map a domain to docker containers?
Rajesh Gandhavarapu
# How can I map a domain to docker containers?

(Asked by: username_0 on 2022-11-30)

I have a Redhat Linux server. In that, I installed docker and run docker containers in it. Now I want to map a domain to docker containers by using Nginx.

What is the correct process to map domains by using Nginx, install Nginx as a container or Install Nginx in the Host server? Any references?

**Tags:** docker, docker-compose, nginx

> **Comments:**
> **username_1**: With, uh, DNS? this question makes no sense as presented.  

---

## 2 answers

### Answer by username_2 on 2022-12-09. Score: 0

**Basics**
Nginx is a webserver that can be used as a reverse proxy. I would suggest having a look at the nginx.conf file, where you can configure DNS redirects accordingly.

**Host**
Nginx on host means you would need a port mapping( host -> docker container) of all the docker containers in order to redirect traffic to the correct container. Wouldn't suggest this.

**Docker**
Nginx on docker on same docker network would be my suggested approach: you can use docker DNS and only map the nginx server itself(ports 80/443).

Maybe a tool based on nginx would help here, which already has lets encrypt support: <https://nginxproxymanager.com/>


---

### Answer by username_3 on 2024-06-26. Score: 0

I guess you want to join the host to a (e.g. windows-) domain and then use this membership of the host in the containers instead of joining the containers themselves to the domain.

I guess that would heavily depend on the container because at least in red hat linux you use realm and SSSD to manage all the necessary processes. You would need to have that in the container and then map all the necessary files for all services. That would be a lot of stuff and i am not sure if it would work.

Another problem, if you have more than one container you map the domain to, would be that you have more than one (virtual) host pose as one to the domain. I guess that does not work with kerberos because they would get in the way of each other when exchanging tickets.

It is probably better to join the containers themselves to the domain. But you would need to have some clever way to pass the admin password into that process or it can not be automated.


---

