Skip to content

Instantly share code, notes, and snippets.

@zironycho
Created January 11, 2022 23:38
Show Gist options
  • Save zironycho/d2ab322763cf07353fb12b8e4137fa6a to your computer and use it in GitHub Desktop.
Save zironycho/d2ab322763cf07353fb12b8e4137fa6a to your computer and use it in GitHub Desktop.
docker + gui + opencv + python3.6

Prequirement

  • Install XQuartz
  • XQuartz configuration: Allow connections from network clients

RUN commands in XQuartz term

$ make build
$ make run
FROM python:3.6.15-buster
RUN pip install \
Pillow==7.2.0 \
opencv-python==4.5.4.58 \
scipy==1.5.4 \
menpo==0.11.0 \
tensorflow==1.14.0 \
scikit-image==0.17.2 \
menpofit==0.7.0 \
opencv-python-headless \
opencv-contrib-python
RUN apt-get update && apt-get install -y \
xserver-xorg-core xserver-xorg xorg openbox \
libgtk2.0-dev \
pkg-config \
libgl1-mesa-glx
WORKDIR /code
name := opencv-gui-python3.6
pwd := $(shell pwd)
build:
@docker build -f ./Dockerfile . -t ${name}
run:
@xhost + 127.0.0.1
@docker run --rm -it \
--privileged \
-e DISPLAY=host.docker.internal:0 \
-v ${pwd}:/code \
${name} bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment