This Docker container captures screenshots of a webpage at configurable intervals and serves them via a simple web interface, perfect for displaying on older devices that can't handle modern web technologies.
- Build and run with Docker Compose:
docker-compose up -d- Access the screenshot viewer at:
http://localhost:8080
Edit the environment variables in docker-compose.yml:
TARGET_URL: The webpage to capture (default:http://192.168.0.121:8180/)RESOLUTION: Screenshot resolution (default:1024x768)SCREENSHOT_INTERVAL: Screenshot frequency in minutes (default:60)PAGE_LOAD_DELAY: Wait time in seconds before taking screenshot (default:10)TZ: Timezone for timestamps (default:America/Toronto)
To reduce API calls and improve performance, you can enable Chrome persistence mode which keeps the browser open between screenshots:
KEEP_CHROME_OPEN: Enable persistent Chrome mode (default:false)CHROME_MAX_MEMORY_MB: Maximum memory usage before Chrome restart (default:1024)CHROME_RESTART_HOURS: Hours before scheduled Chrome restart (default:24)
Example resolutions for older iPads:
- iPad 1/2:
1024x768 - iPad 3/4:
2048x1536 - iPad Mini 1:
1024x768
Example intervals:
5- Every 5 minutes30- Every 30 minutes60- Every hour (default)120- Every 2 hours1440- Once daily
Three image variants are available on Docker Hub:
flucko/screenshot-server:latest- Standard Debian-based image (~300MB)flucko/screenshot-server:latest-alpine- Alpine Linux variant (~180MB)flucko/screenshot-server:latest-slim- Optimized multi-stage build (~150MB)
Update docker-compose.yml to use a pre-built image:
services:
screenshot-server:
image: flucko/screenshot-server:latest-slim # Or :latest, :latest-alpine
ports:
- "8080:80"
# ... rest of configuration# Build the image
docker build -t screenshot-server .
## Run the container
docker run -d \
-p 8080:80 \
-e TARGET_URL="http://192.168.0.121:8180/" \
-e RESOLUTION="1024x768" \
-e SCREENSHOT_INTERVAL="60" \
-e PAGE_LOAD_DELAY="10" \
-e TZ="America/Toronto" \
screenshot-server- Takes a screenshot of the target URL at specified intervals
- Serves the latest screenshot at
/latest.png - Auto-refreshing HTML page displays the screenshot
- Optimized for low-bandwidth and legacy browsers
When KEEP_CHROME_OPEN=true is set:
- A Chrome Manager service starts and maintains a persistent browser instance
- Screenshots reuse the existing browser connection, reducing overhead
- Chrome automatically restarts after 24 hours or if memory limits are exceeded
- Memory usage is monitored and logged when it increases
- Falls back to normal operation if the persistent instance fails
latest.png- Most recent screenshotscreenshot_YYYYMMDD_HHMMSS.png- Timestamped screenshotsindex.html- Auto-refreshing viewer page
The default Docker image is ~300MB due to Chromium and dependencies. For a smaller footprint (~150MB), use the Alpine-based optimized build:
# Use the optimized build
docker-compose -f docker-compose.optimized.yml up -dThis uses:
- Alpine Linux base (5MB vs 120MB)
- Multi-stage build to exclude build dependencies
- Optimized package installation
This repository includes automated Docker builds using GitHub Actions. On every push to the main branch:
- Builds multi-architecture images (amd64 and arm64) for all three variants
- Creates the following tags for each variant:
flucko/screenshot-server:latest(standard build)flucko/screenshot-server:latest-alpine(Alpine variant)flucko/screenshot-server:latest-slim(optimized build)
- Also creates branch and SHA-based tags for versioning
If you're having issues with Chrome persistence mode:
-
Check Chrome Manager logs:
docker-compose logs | grep "Chrome Manager"
-
Verify Chrome status:
docker exec <container-id> cat /tmp/chrome_status.json
-
Monitor memory usage: Look for memory logs indicating when Chrome memory increases or restarts occur.
-
Common issues:
- If Chrome crashes frequently, try increasing
CHROME_MAX_MEMORY_MB - For pages with memory leaks, decrease
CHROME_RESTART_HOURS - Ensure the target URL is accessible from within the container
- If Chrome crashes frequently, try increasing