Python Tkinter in Docker .TclError: couldn't connect to display
As described here, you would need an X11 graphic layer.
But since you are already on an '(X)Ubuntu, setting the DISPLAY should be enough:
export DISPLAY=127.0.0.1:0.0docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix yourImage
Check also XAuthority.
Type xhost +
in your terminal. Then
docker run --rm \ --network=host --privileged \ -v /dev:/dev \ -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v $HOME/.Xauthority:/root/.Xauthority \ -it yourimage
worked for me. xhost +
disables access control. After which a client can connect from any host.