A container is practically a process tree that is separated from other process trees of the host. The magic is that in spite of being just another process tree, it has been setup so that it appears as another system, a system container. In that respect, when you create a container and you expose a specific GPU to that container, you are allowing the container to access the said GPU. When you are running GUI apps in a container, you are tricking the host to consider those container GUI apps are not different from those that run on the host. And the X server or Wayland on the host will happily show the output.
In contrast to containers, there are virtual machines (implemented in Incus with KVM/Qemu). In a typical setup your VM gets a virtualized GPU of the main GPU of the host. You can then run GUI apps in somewhat decent speeds. But if you have two GPUs, can you expose the other GPU (not the one used by the host) exclusively to a VM?
Yes, you can, with something that is called GPU Passthrough. You add gputype=physical and the GPU is gone from the host and appears into the Incus VM (or Incus container). Note that there are a few additional issues to read up on GPU Passthrough.
Therefore, one way is to go exclusive and give the other GPU to a single Incus VM or container.
However, you would rather not lose any of the GPUs from the host.
In that respect, I think that you cannot get a container to use the unused GPU to show a GUI app on the host. I think you have to configure first the host to use the two GPUs separately in two desktops, then configure the containers to show their GUI windows to the respective desktop. That is, the quest is how to get two separate desktops on two separate displays on the same host. This is doable with a VM and GPU Passthrough. I feel it should be doable with some weird X11 configuration.
Also I tried this and it works on Incus. It’s desktop in a container.