Mount X11 driver to run Mayavi/GUI dependent script

I am relatively new to working with Docker, so any help with my problem would be appreciated. Thank you.

Problem
Unable to properly mount the x11 to a docker container with the requisite drivers. Read a number of forums on getting a GUI app to run in a container, however still not able to get the script for fully run.

What’s the goal: Run a script using Mayavi module which creates an image.

Environment:
Mac OSX 10.15.3
Docker Desktop For Mac 2.2.0.3

Dockerfile:

FROM ubuntu:18.04

ENV PATH="$HOME/.local/bin:$PATH"
RUN export PATH

ENV QT_DEBUG_PLUGINS=1
ENV QT_GRAPHICSSYSTEM="native"
ENV QT_X11_NO_MITSHM=1
ENV LIBGL_DEBUG "verbose glxgears"

RUN apt-get update && apt-get install -y \
    git \
    ca-certificates \
    make \
    curl \
    automake \
    autoconf \
    libtool \
    wget \
    pkg-config \
    xvfb \ 
    libgl1-mesa-dev \
    libqt5x11extras5 \
    libxkbcommon-x11-0 \
    libxcb-randr0-dev \
    libxcb-xtest0-dev \
    libxcb-xinerama0-dev \
    libxcb-shape0-dev \
    libxcb-xkb-dev \
    locate \
    build-essential \
    zlib1g-dev \
    libncurses5-dev \
    libgdbm-dev \
    libnss3-dev \
    libssl-dev \
    libreadline-dev \
    libffi-dev \
    libxml2-dev \
    libxslt1-dev \
    libxext-dev \
    libx11-dev \
    x11proto-gl-dev \
    mesa-utils && \
    rm -rf /var/lib/apt/lists/*

RUN apt update && apt install -y \
    software-properties-common 

RUN add-apt-repository -y ppa:deadsnakes/ppa

RUN apt update && apt install -y \
    python3.7 \
    python3.7-dev 

RUN mkdir /tmp/src
WORKDIR /tmp/src

RUN wget https://bootstrap.pypa.io/get-pip.py 
RUN python3.7 get-pip.py

RUN ln -s /usr/include/python3.7/* /usr/include/

RUN python3.7 -m pip install numpy==1.18.1 \
    && python3.7 -m pip install vtk==8.1.2 \
    && python3.7 -m pip install mayavi==4.7.1 \
    && python3.7 -m pip install pyqt5==5.14.0 

RUN mkdir -p /usr/local/bin/platforms \
    && ln -s /usr/local/lib/python 3.7/dist-packages/PyQt5/Qt/plugins/platforms/libqxcb.so /usr/local/bin/platforms 

COPY depthData.txt .
COPY image_3d.py .
COPY entrypoint.sh .

CMD ["python3.7", "my_python_script.py"]

Start XQuartz
open -a xquartz

One attempt to mount X11 to container:
ip = $(ifconfig en0 | grep inet | awk ‘$1=“inet” {print $2}’
xhost +$ip

docker run -it -e DISPLAY=$ip:0 --name blahblahblah -v /tmp/.X11-unix:/tmp/.X11-unix test_run

RESULT:
QFactoryLoader::QFactoryLoader() checking directory path “/usr/local/lib/python3.7/dist-packages/PyQt5/Qt/plugins/accessible” …
QFactoryLoader::QFactoryLoader() checking directory path “/usr/bin/accessible” …
libGL: Can’t open configuration file /etc/drirc: No such file or directory.
libGL: Can’t open configuration file /root/.drirc: No such file or directory.
libGL: Can’t open configuration file /etc/drirc: No such file or directory.
libGL: Can’t open configuration file /root/.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
ERROR: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 606
vtkXOpenGLRenderWindow (0x55b930cc9e50): Cannot create GLX context. Aborting.

Next attempt:
in Dockerfile:
Changed CMD [“python3.7”, “my_python_script.py”] to #CMD [“python3.7”, “my_python_script.py”]

docker run -it -e DISPLAY=$ip:0 --name blahblahblah -v /tmp/.X11-unix:/tmp/.X11-unix test_run

In Container:
#Attempt to install Nvidia drivers
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/331.67/NVIDIA-Linux-x86_64-331.67.run .
./NVIDIA-Linux-x86_64-331.67.run -a -N --ui=none --no-kernel-module

#Run the script
python3.7 my_python_script.py

RESULT:
ERROR: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 606
vtkXOpenGLRenderWindow (0x562856ea07d0): Cannot create GLX context. Aborting.

Another attempt to mount X11:
Brew install socat
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:"$DISPLAY"
NOTE: DISPLAY value is /private/tmp/com.apple.launchd.IoOdg4mzJH/org.macosforge.xquartz:0

RESULT:
socat[38815] E bind(5, {LEN=0 AF=2 0.0.0.0:6000}, 16): Address already in use