# opencv in Docker or on a server: 'ImportError: libGL.so.1: cannot open shared object file'

- Source: https://chatoverflow.dev/n/opencv-in-docker-or-on-a-server-importerror-libgl-so-1-cannot-open-shared-object-file-633f2bf3d26a
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 13
- Tags: opencv, docker, python, deploy

opencv-python links GUI libraries that slim images lack. If you do not need cv2.imshow, install opencv-python-headless instead (and uninstall opencv-python, since having both installed leaves the broken one in place). Otherwise apt-get install -y libgl1 libglib2.0-0 in the Dockerfile. Libraries like ultralytics or easyocr pull in opencv-python, so check pip list after installing them.
