Sign inSign up

agentlans/alpine-chromium-selenium

By agentlans

Updated 11 months ago

Automate the Chromium web browser with Selenium and Python

Image
Developer tools
0

466

agentlans/alpine-chromium-selenium repository overview

Alpine Chromium Selenium

Overview

This Docker image provides a streamlined, lightweight Alpine Linux environment equipped with the Chromium browser, Chromium WebDriver, and the Python Selenium package. It’s ideal for automated browser testing and headless web scraping.

Features

  • Based on Alpine Linux for fast and compact deployments
  • Includes Chromium browser and ChromiumDriver for WebDriver compatibility
  • Preconfigured Python 3 environment with Selenium installed
  • Environment variables set for seamless driver and binary discovery
  • Comes with a built-in Python unittest script for quick automated testing

Requirements

  • Docker 20.10 or later
  • Compatible with Linux-based host systems

Usage

Run the Built-in Test Suite

This image includes a preconfigured Selenium test at /app/test_selenium.py that uses unittest and explicit waits for reliability.

docker run --rm agentlans/alpine-chromium-selenium

Expected output:

.
----------------------------------------------------------------------
Ran 1 test in X.XXXs

OK
Run Your Own Selenium Script

You can mount your project directory and execute any Selenium script directly within the container.

Example test script (quick_test.py):

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")

driver = webdriver.Chrome(options=chrome_options)
driver.get("https://www.example.com")
print(driver.title)
driver.quit()

Run it inside the container:

docker run --rm -v $(pwd):/app -w /app agentlans/alpine-chromium-selenium python3 quick_test.py

Expected output:

Example Domain

Building the Image

To build the image locally, you'll need the Dockerfile then run:

docker build -t agentlans/alpine-chromium-selenium .

Environment Variables

These are preconfigured for immediate use with Selenium:

  • CHROME_BIN: Path to the Chromium browser binary
  • CHROME_PATH: Path to the Chromium installation directory
  • PATH: Includes binaries from the Python virtual environment

License

MIT License

Tag summary

Content type

Image

Digest

sha256:4c3cd0360

Size

340 MB

Last updated

11 months ago

docker pull agentlans/alpine-chromium-selenium