Hudrolax / uc-docker-alpine

undetected chromedriver in Docker container based on Alpine Linux
23 stars 3 forks source link

Enable GPU #1

Open alcpereira opened 1 year ago

alcpereira commented 1 year ago

Hi!

Congrats for this repo, this is the best Docker implementation for undetected_chromedriver I've seen so far.

I don't know if it's related to x11vnc or not, but I can't use GPU on the driver. Any idea why? I've tried quite a lot of things and I'm out of ideas.

alcpereira commented 1 year ago

Found a solution using chromium-swiftshader. Want me to open a PR?

Hudrolax commented 1 year ago

Hi!

Congrats for this repo, this is the best Docker implementation for undetected_chromedriver I've seen so far.

I don't know if it's related to x11vnc or not, but I can't use GPU on the driver. Any idea why? I've tried quite a lot of things and I'm out of ideas.

Using a GPU inside a Docker container is a special scenario that requires specific flags when launching the container to pass through your GPUs to the container. To use CUDA inside the container, the corresponding libraries will also need to be installed in the image. Start with a ready-made image from https://hub.docker.com/r/nvidia/cuda.

This is a comose example to enable GPU support - https://docs.docker.com/compose/gpu-support/

alcpereira commented 1 year ago

Sorry, I forgot to mention, it was due to a website that uses ThreeJS. It was not loading properly because WebGL was not available.

You can check by going to chrome://gpu or load any examples of this website.

swiftshader did the trick, but if you have other solutions feel free to suggest.

To my understanding, CUDA only works with Nvidia GPUs right? I also aim to use cheap hosting solutions so GPU-oriented machines would be too expensive.

ehtec commented 1 month ago

Hey @alcpereira! I would be interested in your modification using chromium-swiftshader you wanted to open a PR for, could you upload it somewhere & send a link to the code? Would appreciate it, thanks! I was going to build exactly that.