dockernginxjwilder-nginx-proxy

Why nginx are required to be run on docker sometimes?


I'm learning about docker and nginx(jwilder/nginx-proxy, ...). During configurations, I couldn't figure the reason out why I should install nginx on docker. AFAIK, It is possible to access containers using their exposed ports and only one nginx on my real host can serve them all. Which advantages can be expected when nginx is run as a container?


Solution

  • Nginx servers are not required to run as a container, and if you do not see advantages in doing so, there is no harm in trying it your way.

    Some points to consider:

    1. Some production configurations are exclusively docker based. For example, when you are running Kubernetes or a Swarm setup. In these configurations, the virtual servers only run the docker engine, nothing else.
    2. Running nginx as a container has the same advantages as running anything else as containers - it (auto-) scales, it is kept healthy by the orchestrator, it is portable and reproducible.
    3. Since you mentioned jwilder's reverse proxy - you are probably aware of the fact that it is an automated reverse proxy designed exclusively for docker. It will automatically detect new or updated containers, and adjust its configuration to match.