7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

dockerコンテナ内などでqtを使用したアプリ使用時にエラーが出る。qt.qpa.xcb: could not connect to display

Posted at

dockerコンテナ内などでqtを使用したアプリ使用時に以下のようなエラーが出る。

$ python test.py
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted

以下のように仮想的なDISPLAYを用意する事で解決

sudo apt install -y xvfb
export DISPLAY=:1
nohup Xvfb -ac ${DISPLAY} -screen 0 1280x780x24 &

参考

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?