Opengl glxgears in docker container

I am trying to pull this of for quite a few time. I want to run pygame.init() inside docker container. Following are the steps are taken to achieve::

Fresh ubuntu 20.04 with nvidia 460 proprietary drivers version installed.
Docker installed from docker documentation.

Nvidia-docker 2 installed for gpu usage inside the container.

Run docker container with following command:
docker run -it -e DISPLAY --net host --gpus all nvcr.io/nvidia/tensorflow:20.06-tf2-py3

However when I install pygame inside the container it doesn’t work.
Since it throws an error

pygame.error: No available video device

I have also tried glxgears it doesnt work either. However I found this cuda/opengl repo inside which glxgears works very well.

https://hub.docker.com/r/nvidia/opengl

What should I install or configure so that my display is available in nvcr.io container.

Note: I have already done sudo xhost + command
Please help

You have to properly set the DISPLAY variable to the Xserver you want to use and have access to.
e.g.
-e DISPLAY=:1

Hi Thanks for the suggestion I have already tried:
-e DISPLAY= $DISPLAY
-e DISPLAY= :1
-e DISPLAY= unix$DISPLAY
-v x11 socket mounting

but doesnt seems to work however it works if I use following base image

https://hub.docker.com/r/nvidia/cudagl

which is based for 11.2. But my audio still doesnt work inside it.

I have nvidia driver version 460 with CUDA version 11.2 on the host machine while my CUDA toolkit is not installed.
While CUDA toolkit inside my cudagl is 11.2. Here it works fine. with above tag.

It doesn’t work only while I am use my own image. In which it use to work few days ago. I have tried to downgrade my nvidia driver version to 450. It still doesn’t work.

I have tried to install GitHub - NVIDIA/libglvnd: The GL Vendor-Neutral Dispatch library which is based for cudagl images to use glx inside docker.

If it works for cudagl. I suspect something has gone wrong in my docker image. Maybe some mistmatch. Also,
apt purge nvidia* does not remove all of the nvidia. Kernels are left behind and if I install new drivers my host display is blacked out completely.