jozo / docker-pyqt5

Dockerfile for development of GUI applications with Python 3 + PyQt5
84 stars 24 forks source link

qt.qpa.xcb: could not connect to display $IP:0 #5

Closed kaka-lin closed 3 years ago

kaka-lin commented 3 years ago

Hi,

When I use it on macOS as the below method, I got the error: qt.qpa.xcb: could not connect to display $IP:0

IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost +
docker run --rm -it \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e DISPLAY=$IP:0 \
    -u qtuser \
    jozo/pyqt5 python3 /tmp/hello.py
kaka-lin commented 3 years ago

I solved !

jozo commented 3 years ago

@kaka-lin can you please share your solution? I guess the problem was that XQuartz was not running.

kaka-lin commented 3 years ago

@jozo I used host.docker.internal:0 instead of $IP:0

This is my repo: https://github.com/kaka-lin/qt-template/tree/master/docker