Access USBwebcam in docker containers from Ubuntu local machine

I am trying to access the webcam from the docker container but I am getting this error . Can someone please help me with this ?
I committed a container from an image available from the dockerhub (spmallick/opencv-docker )which has openCV and python

docker run -it --device=/dev/video0:/dev/video0 -v /tmp/.X11-unix:/tmp/.X11-unix -v ${HOME}/.Xauthority:/home/.Xauthority -e DISPLAY=$DISPLAY -p 5000:5000 -p 8888:8888 -it finaltest1 /bin/bash

ERROR:
(python3:107): GStreamer-CRITICAL **: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed
No protocol specified
QXcbConnection: Could not connect to display :0
Aborted (core dumped)

Is it possible to access the webcam from a container ?

1))As docker image I am using romankspb/webcam.
These are the commands I use.

2))pull
sudo su
docker pull romankspb/webcam

3)) This is useful to use a GUI application inside docker.
sudo su
xauth list
xhost
xhost+
xhost +local:docker

4))Now I run my container with this command:
sudo su

SOCK=/tmp/.X11-unix docker run --name webcam001 -it --privileged --volume “$HOME/.Xauthority:/root/.Xauthority:ro” --volume “/media/ubuntu/shareddir1:/media/ubuntu/shareddir1” --network=host -e DISPLAY=$DISPLAY -v /dev/video0:/dev/video0 -v /dev/video1:/dev/video1 -v $XSOCK:$XSOCK romankspb/webcam

5))The image romankspb/webcam is available online
http registry. hub. docker. com/r/romankspb/webcam