Access shared library inside a Docker container Access shared library inside a Docker container docker docker

Access shared library inside a Docker container


To access shared libraries inside docker, below is one of the ways:

  1. Use "COPY" command inside Dockerfile to copy the shared libraries/dependencies inside the container. Example: COPY {local_path} {docker_path}
  2. Set the environment variable where shared libraries are searched for first before the standard set of directories. For instance for Linux based OS, LD_LIBRARY_PATH is used. Environment variables can be set via Docker's Environment replacement (ENV) Example: ENV LD_LIBRARY_PATH={docker_path}:$LD_LIBRARY_PATH


In the Dockerfile that builds the container, run the installation commands that install the package that provides the shared library.


This is my DockerFile:

FROM mono:latestADD . /srcWORKDIR /srcRUN xbuild BlackBox.csprojCMD ["mono", "/src/bin/Debug/BlackBox.exe"]

So i have to do something like this:

FROM mono:latestADD . /srcWORKDIR /srcRUN apt-get install neededthing another so_onRUN xbuild BlackBox.csprojCMD ["mono", "/src/bin/Debug/BlackBox.exe"]

Am I right, @Raedwald?