[Fixed]-Should nginx be packed into the same container as Django when deploying with Docker Swarm?

9👍

Based on production experience, it’s better to counterpart rule from docker docs one container for one process. You’re shipping a (micro-)service with docker image, and if it’s required to have nginx in it, you include it.

So basically for django app there are:

  1. nginx (e.g.: for static files)
  2. gunicorn or uwsgi
  3. django code itself

Don’t see any perfomance issue on adding nginx to container, but little note on docker image size. On ubuntu:16.04/debian:jessie by adding nginx-full you increase your image size for around ~100mb. (some overhead on first pulling image).

So it’s not controversal to second scenario, because you can also add nginx behind your docker image for balancing purpose (or proxy_pass managing).

Leave a comment