Could not load the Qt platform plugin (while dockerizing the application)

Viewed 1489

I have built a face detection app using opencv and transfer learning model (resnetSSD). Output of application : video will open and model will be able to recognize the faces.

Application is running perfectly in my local system .. Able to build the docker also , but when running the docker container below error i am getting:

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.6/dist-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

please suggest how i can fix this ??

1 Answers

To show images from inside Docker container you should run it like below:

docker run -it \
   -e DISPLAY=$DISPLAY \                # <--- here
   -v /tmp/.X11-unix:/tmp/.X11-unix \   # <--- Here
# everyting else

After making sure cv2 is properly installed in docker image you may wish to run

xhost +local:root

on the host machine (assuming it's a local experiment).

Related