Build python opencv with gpu enabled
docker image build \
--build-arg HOST_XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
-t cv2-gpu:v6 -f cuda10.1-cudnn8-devel-ubuntu18.04/Dockerfile .
docker image build \
--build-arg HOST_XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
-t nd-cv2-gpu:v1 -f darknet_failed_all_gpu_acc_on/Dockerfile .
or cd in it
docker image build -t cv2-gpu:py3.6 .
sudo docker image build -t cv2-gpu:py3.6 .
- create container
docker run \
-it \
--gpus all \
--net=host \
-v $(pwd):$(pwd) \
-v /tmp/.X11-unix/:/tmp/.X11-unix \
-v /tmp/.docker.xauth:/tmp/.docker.xauth \
-v $(XDG_RUNTIME_DIR):$(XDG_RUNTIME_DIR) \
-e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
-e XAUTHORITY=/tmp/.docker.xauth \
-e DISPLAY=$DISPLAY \
-w $(pwd) \
--privileged \
--name cv2gpu_ctnr1 cv2-gpu:py3.6
- run the container in detach
docker start cv2gpu_ctnr1
- enter in container
docker exec -it cv2gpu_ctnr1 bash -c "cd $(pwd) && bash"
docker image build \
--build-arg HOST_XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
-t cv2-gpu:cv2cc8.6 -f cv2cc8.6-cuda11.7.1-cudnn8-devel-ubuntu18.04/Dockerfile .
docker image build \
--build-arg HOST_XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
-t cv2-gpu:ub20cv2cc8.6 -f cv2cc8.6-cuda11.7.1-cudnn8-devel-ubuntu20.04/Dockerfile .
check
docker run -it --rm --gpus all cv2-gpu:ub20cv2cc8.6 /bin/bash