Docker Community Forums

Share and learn in the Docker community.

Share a library between Docker containers

docker

#1

I am new to Docker and I would like to create my first app using two containers with Docker compose.

My first container contains the Qt library and the second container contains the OpenFace library.

I want to use the Qt container to build (with qmake) my C++ project that refers to the OpenFace library in the second container.

So, I created a docker-compose.yml file like this:

version: "3"

services:
 openface:
  image: algebr/openface:latest
  tty: true
  devices:
   - "/dev/video0:/dev/video0"
  environment:
   - DISPLAY=$DISPLAY
  volumes:
   - "$HOME/.Xauthority:/root/.Xauthority:rw"
   - "./Workspace:/Workspace"

 qt:
  image: sgclark/trusty-qt59
  volumes:
   - "./Workspace:/Workspace"

The Workspace folder is the shared folder that contains the C++ project.

The containers start correctly but I don’t have the result that I expected. When I build the project with qmake it returns error because it can’t find the OpenFace library.

Am I using Docker in the right way? If yes, how can I fix my set up to build and run the app?

Thanks in advance for your help.