Docker Community Forums

Share and learn in the Docker community.

How common is library sharing between containers and host?

Hi everyone,

I am researching shared libraries between containers from security point of view.

In many security resources, the shared library scenario, where containers share dependency reference (i.e. same file) is discussed, I can come up with two scenarios:

1.De-facto discussed scenario - where some lib directory is mounted from the host machine to container
2.Invented scenario - where a shared volume is created for different containers (different services, replicate set of same container, or both), and it is populated with libraries which are shared between all of the containers.

Despite the discussions, I was not able to find this kind of behavior in real world, so the question is: How common is this approach, really?

A reference to an official and known image which uses this technique would be great!

This best practices of Docker are to package the library into the image, and not rely on a library file being present on the host.

Volumes are generally utilized for stateful data, not application dependencies.

The approaches you outlined are not especially common in practice.