How to run hardware accelerated gui apps on docker without using --net=host

Hello,

So I’m trying to run both centos7 and Ubi-8 docker containers with Nvidia runtime (and all capability) on Fedora 36 host with hardware acceleration. It works if I use --net=host, but I want to give the docker its own bridge network. However, if I do this, it can’t connect to display 0.0. Is there a way I can tell docker to directly access the host display without any ssh? I could do this by setting xhost to +local:root back when I used moby engine, but I guess with official docked and Nvidia runtime it’s different? Also, I believe that method is also insecure too. So looking for a better option

New update, centos docker has no issues with x11 on any network (host or bridge). However the moment I run ubi-8 container, it breaks x11 and display for all running containers and for any other new containers started after. This persist till reboot.

This is particularly weird…