Given a traditional Linux server ie- Ubuntu on a VPS

and a commercial app that requires a handful of Docker containers each of which need to communciate to one another ...

with one of those containers needing to serve port 80/443 on a public www domain...

is it better to setup an OS level Nginx that can sit outside the docker ecoysystem and simply proxy traffic to the single 'server' container? (ie- install at OS level: nginx, docker and docker-compose)

or would it be better to instead put an Nginx image in each of the containers that need it? (ie- install at OS level only docker and docker-compose; Nginx installed only inside containers)

by 'better' I am leaving that open to interpretation but definitely leaning to simpler configuration & ease of operation, noting that said commercial app needs of course a convenient way to switch to a different set of env vars for local dev, staging and prod. Extra points for a tidy way to also handle secrets, git, and Dockerhub based continuous deployment.

  • thinking on this further I realized a more common setup is a single nginx docker container alongside your other containers or one of your containers includes nginx inside of it amongst say a web app that listens on port 80; vs ie- multiple containers each running an instance of nginx.
    – Derrick
    Jul 27 at 3:30
  • And at this point I assume the main reason to dockerify nginx vs installing it at root is simply the ability to easily pass in diff ENV vars depending on if you are running in dev, stage or prod. Though you could also have a root OS install nginx and symlink your .conf configs to it via docker volumes, so I am not yet convinced why nginx needs to be containerized in the context of a Linux VPS in whereby the install/setup of nginx is only a one-liner anyway.
    – Derrick
    Jul 27 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.