Replies: 1 comment
-
Yeah, this happens because Docker on Linux exposes subtle fingerprinting differences that headless Chrome can't fully mask, even with undetected-chromedriver. The platform shows as Linux, WebGL rendering often defaults to SwiftShader, and missing fonts or subtle performance timings give it away. Even if your code, config, and IP are identical, the container leaks clues that trigger Google’s bot detection. You can reduce this by installing common desktop fonts, spoofing navigator properties like platform and hardwareConcurrency, bumping shared memory with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using the lastest version of uc.
When I run the app (with browser headless) on my windows computer, it works (no Captcha) every time, for hours.
When I put it in a docker container (python:3.12-slim-bullseye), I get the Captcha at the 1st access to the website. Same code, same config, same IP, same everything.
This is hence not a problem of accessing the site too much but some problem related with the container/linux/environement.
FYI, the website is google reverse image search
Any idea what the problem could be? Any idea how to hide the fact that it is running in a container / linux?
My settings are:
chrome_options = uc.ChromeOptions()
chrome_options.add_argument("--start-maximized") # Start in full-screen mode
chrome_options.add_argument('--headless=new') # Run in headless mode
chrome_options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36") # Fixed user agent
chrome_options.add_argument("--window-size=3840,2160") # Simulate 4K resolution
chrome_options.add_argument("--no-sandbox") # The sandbox is a security feature in Chrome that adds an extra layer of protection by isolating the browser from the underlying system.
chrome_options.add_argument("--disable-dev-shm-usage") # /dev/shm is a shared memory space used by Chrome for rendering. In Docker containers, this space is often limited (usually 64MB), which can cause Chrome to crash on memory-intensive pages. This flag tells Chrome to disable the use of /dev/shm and instead use /tmp for shared memory, which is less likely to have size restrictions.
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--disable-notifications") # Disable browser notifications
chrome_options.add_argument("--disable-popup-blocking") # Disable popup blocking
chrome_options.add_argument("--disable-extensions")
Beta Was this translation helpful? Give feedback.
All reactions