What is better: Nginx in Docker or outside Docker?

Hi together,

what is the better strategy:

Nginx in Docker or outside Docker?

I think that the Nginx in Docker ist better as outside Docker (Directly on the server)! There should be three docker who need nginx. Nginx outside Docker (Directly on the server) is for me a single point of failure!

What is your opinion?

Thank you for the answers. :slight_smile:

It depends on your use case, really.

In my experience, I have never seen Nginx itself crash (not that it cannot happen). If an Nginx instance was misbehaving, it was caused by the environment (server out of disk space or memory, network going crazy, etc). It that regard, Nginx inside a Container on a server or directly on said server won’t matter much.

I do however make an Nginx image part of my docker-compose file. I like the “self-sufficient” property of my docker-compose scripts. Anyone can check out the project on their workstation and issue a docker-compose up and access the service on http://localhost/.

We also tend to have a bit of rewrite and routing rules in Nginx, and I consider those part of the application (or part of the application’s configuration anyway). Since I want all the environments, including developer’s workstations, to reflect the production as much as possible, it just make sense to spin up an instance of that router on their laptop and let them have a configuration that is very close to what will be actually running in production.

Super, thank you. :slight_smile: