Skip to content

This project facilitates running a Windows Chrome antidetect browser using the Nodriver automation library within a Docker Linux container with Wine. This setup eliminates the need for a Windows virtual machine, making the process easier, faster, and more efficient.

Notifications You must be signed in to change notification settings

uxumax/docker-wine-chrome-nodriver

Repository files navigation

Project Overview

This project facilitates running a Windows Chrome antidetect browser using the nodriver automation library within a Docker Linux container with Wine. This setup eliminates the need for a Windows virtual machine, making the process easier, faster, and more efficient.

Prerequisites

Ensure you have Docker Engine installed. If not, follow the installation guide here. If you want run docker as non-root user do not forget about this

Setup Instructions

  1. Upload Antidetect Chrome Browser:

    • Place your preferred antidetect Chrome browser in the chrome/bin directory.
    • Ensure chrome.exe is located at chrome/bin/chrome.exe.
  2. Create Dotenv File:

    • Run the following bash script to generate .env file
      ./create_dotenv.sh
    • The .env contains:
      • PROFILE_NAME: The name of the browser profile (--user_data_dir chrome arg). You can set any name, create profiles as needed, and reuse them. All profiles are stored in chrome/profiles/. Feel free to add or remove profiles as necessary. If you run ./run.sh with a non-existent profile, a new blank one will be created.
      • SCRIPT_NAME: The name of the script to run. All scripts are located in chrome/scripts/. Each script should contain a run() function as the entry point.
      • Rest system env variables that accessible in Chrome Nodriver context
  3. Build and Run the Docker Container:

    • Run the following command to build the container with Wine:
      ./build.sh
    • Execute the following command to run the container. This script will handle the post-build GUI Wine installation wine-mono and python on the first run. Subsequent runs will be ready for use:
      ./run.sh 

Example Script

Below is an example of a Chrome nodriver script that demonstrates how to create your own scripts:

import os

async def run(driver):
    url = os.getenv("BROWSER_CHECKER_URL")
    await driver.get(url)
    while True: pass  # keep browser open

This script opens an online browser fingerprint checker. The URL is retrieved from .env. By default, the file contains the following entries, with only one uncommented:

BROWSER_CHECKER_URL=https://abrahamjuliot.github.io/creepjs/

You can manage these environment variables by setting new ones and accessing them using os.getenv in your automation scripts.

Shared Directory

You can use the ./sharedir directory for file uploads or downloads in your automation scripts. It is accessible at:

  • /home/wineuser/sharedir inside the Linux container
  • Z:\\home\\wineuser\\sharedir inside the Wine context

Recommended Chrome Browser

You should use an antidetect Chrome browser. This involves modifying the original Chrome source code to make the browser undetectable. This mean spoof Canvas, WebGL, Audio, WebRTC (etc) detection and set these spoofing params with Wine environ variables in .env

Possible issues

This project built and tested on Debian 12 (bookworm) Docker host. So here are known possible issues below

Chrome black window

If chrome run with black window then try restart X window manager with this script

./debug/reset_display.sh

Wine issues

If Wine broken you can resinstall it this way. Do not worry your browser profiles and nodriver scripts will NOT be deleted.

./debug/clear_wine_prefix.sh

Then just run you profile and script with ./run.sh to reinstall


About

This project facilitates running a Windows Chrome antidetect browser using the Nodriver automation library within a Docker Linux container with Wine. This setup eliminates the need for a Windows virtual machine, making the process easier, faster, and more efficient.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published