Docker Community Forums

Share and learn in the Docker community.

Not able to display Video in Docker


(Sagar14) #1


I’m using the following code. The code read a video, convert each frame in gray scale, and then display the frame. So basically, the code make the video black and white and display it.

import numpy as np
import cv2
video_capture = cv2.VideoCapture("randomVideo.mp4")    

while True:
    ret, frame =
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    cv2.imshow('frame', gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
# Release handle to the webcam

But I’m getting the following error:

(frame:1000): Gtk-WARNING **: cannot open display:

Can anyone please tell me how to resolve the issue? I understand that the docker image doesn’t contain the display driver or display mode. . But which driver I need to install?

Thank you!

(Think) #2

best is when you just provide access to your X server. A good starting point could be the following:

Hope this helps.

(Sagar14) #3

@think: Thanks for your suggestion. It seems like a good point to start.

Thanks again!

(Skyhighakash256) #4


Were you able to get the video displayed in docker, if yes, could you please elaborate a bit??