Multi nginx or sharefolder?

I have a question, is it possible to share a file between 2 containers? I explain to you. I have a container with nginx and a container that contains a django project. Nginx must share the static files of django. and not having to make a link between the container> the main folder> the other container.
On a digital ocean tutorial ( he proposes to create a new container and reinstall nginx for a new project. Does not it risk overloading the processor?
Would not it be more efficient to just create a container with nginx to do a reverse proxy on the address of another container that contains the project and share a common file for static files ??
thank you in advance :slight_smile:

With nginx I would not worry about the CPU too much. However, yes it is possible to bind-mount a host folder into multiple containers and even make sure that the contents are accessible by means of UID/GID mapping.

So what you’d be doing is to simply create a folder on the host running those containers and then bind-mount that into the container. In terms of the YAML configuration that’s the devices node:

    path: django
    source: /source/path/to/static/files/on/host
    type: disk

Hope this helps.

It is a common issue with containers where to store the data, considering that it is good to separate your data from the software.

One way is to just put your data in the container. You can back them up from the host as needed. Other solutions are ok as well, so pick and choose.