Should you install nginx inside docker?

I am wondering about the pros and cons of whether or not you have nginx inside your docker image. There are many tutorials on how to install nginx on docker, but what I'm asking is, should you or shouldn't?

Should you install nginx on a docker host and point to separate running containers (which can run rainbows, etc.)? or

Should you install another nginx layer inside your containers?

I don't see any benefit to having another nginx inside docker containers, but then I wonder why there are so many tutorials on this like it's common sense and I don't get common sense, which makes me frustrated.

edit:

The fewer settings for the container, the better for me. If there is a tight connection between the nginx container and the application container, then this is definitely not the solution I am looking for and beats the goal of having containers in the first place. This is why I am leaning towards installing nginx on a Docker host.

If we are to have an nginx container, the container must be application independent. Application-specific configuration such as port numbers and IP addresses, number of worker processes client_max_body_size

should not be configured in a container if they cannot be configured at runtime docker run

.

+3


source to share


1 answer


This can be closed as opinion-based, but in my opinion dockers should be involved in networking with the transport layer (TCP / UDP) but not above (HTTP). So I would say no, you should not install nginx as a reverse proxy directly to your docker host directly, and yes, you should install nginx in your container (s) if you want nginx functionality to provide.



You can decide that you need an nginx container in front of each of your applications (this seems to fit the general idea of โ€‹โ€‹containerization and sharing rather than exchange of things) or a single nginx container for a reverse proxy. Multiple applications hosted in containers on the same host (easiest, but more closely related, and perhaps less harmonious with docker philosophy). You can also take the fusion style and put both your application and its nginx in the same container which provides a nice coherent block, but otherwise this is against the general case of 1 process tree per container.

+2


source







All Articles