Installing extension inside a Dockerfile

assuming the extensions to be installed in extensions.py

docker command
RUN /opt/slicer/bin/Slicer --no-main-window --python-script ./extensions.py
fails due to lack of X environment. specific error:

qt.qpa.screen: QXcbConnection: could not connect to display Could not connect to any X display