Try to build panda3d using on a headless machine (no x-11) using egl

I need to build panda3d on a headless machine(docker)(ubuntu 16.4, python 3.8), I just read this link:

so basically, I make panda3d using python3 makepanda/ --everything --wheel --no-x11 --no-gles, pip install the wheel and writting this script and run:
from panda3d.core import *
load_prc_file_data("", "load-display pandagles2")
load_prc_file_data("", "notify-level-egldisplay spam")
load_prc_file_data("", "gl-debug true")
from direct.showbase.ShowBase import ShowBase
base = ShowBase(windowType='offscreen')
model = loader.loadModel('environment')
base.screenshot('test.jpg', defaultFilename=False)

and it comes with this error:

Known pipe types:
(all display modules loaded.)
:display:egldisplay(error): no-x11:display:egldisplay(error): Couldn’t initialize the EGL display: EGL_NOT_INITIALIZED
:ShowBase(warning): Unable to open ‘offscreen’ window.
Traceback (most recent call last):
File “”, line 9, in
base = ShowBase(windowType=‘offscreen’)
File “/usr/local/lib/python3.8/dist-packages/direct/showbase/”, line 333, in init
self.openDefaultWindow(startDirect = False, props=props)
File “/usr/local/lib/python3.8/dist-packages/direct/showbase/”, line 1014, in openDefaultWindow
self.openMainWindow(*args, **kw)
File “/usr/local/lib/python3.8/dist-packages/direct/showbase/”, line 1049, in openMainWindow
self.openWindow(*args, **kw)
File “/usr/local/lib/python3.8/dist-packages/direct/showbase/”, line 794, in openWindow
raise Exception(‘Could not open window.’)
Exception: Could not open window.

I think I need to modify some scripts else, but I am really new to egl, can anybody give me some hints? Thanks.

Do you have hardware acceleration / access to the GPU from your Docker container? I think you need special steps for that.

You should be able to use pandagl as well with this method, by the way.