Kali LXD container can not export display

I followed this tutorial: https://www.kali.org/docs/containers/kalilinux-lxc-images/#gui-kali-lxd-container-on-ubuntu-host

sudo lxc exec my-kali -- echo "export DISPLAY=:0" >> /home/kali/.bashrc
bash: /home/kali/.bashrc: No such file or directory

I try log in my kali in console lxc and edit .bashrc file but I can not export GUI Kali linux. Can somebody help me?


The following command is not meant to work as intended.

sudo lxc exec my-kali -- echo "export DISPLAY=:0" >> /home/kali/.bashrc

The intention is to append to the file /home/kali/.bashrc in the Kali container the command export DISPLAY=:0. But the shell on the host has the semantics that the redirection gets associated to the sudo lxc exec command, therefore it tries (and fails) to find a /home/kali/.bashrc on the host.

I wrote a post on setting up X11 for a Kali LXD container,