Open2

DockerコンテナからGUIを起動する

SENKENSENKEN

手始めにxeyesを起動してみる
https://qiita.com/hoto17296/items/7c1ba10c1575c6c38105
すると起動時にエラーが出た

docker run --rm -it \  
--net host \
-e DISPLAY=$DISPLAY \
-v $HOME/.Xauthority:/root/.Xauthority \ # これはなくても起動できた
xeyes
Authorization required, but no authorization protocol specified

Error: Can't open display: :0

これで解決した
https://stackoverflow.com/questions/73490184/sudo-nautilus-gives-authorization-required-but-no-authorization-protocol-specif

ローカルで次のコマンドを打つ

xhost + local:

xhostが入っていない場合は

sudo apt install -y x11-xserver-utils

でインストールできる

SENKENSENKEN

Docker Composeの場合は

docker-compose.yml
environment:
  - DISPLAY=$DISPLAY
network_mode: "host"

を追記すれば良い