Docker image for bauer-group/CS-ClientPublicIP - automatically synced from GitHub
1.9K
A lightweight, production-ready microservice for public IP address detection with GeoIP country lookup. Returns client IPv4 and IPv6 addresses via web interface, JSON API, or plain text.
# Clone and configure
cp .env.example .env
vim .env # Add MaxMind credentials and configure hostname
# Start with Docker Compose (Coolify/Standalone)
docker compose up -d
# Or with Traefik
docker compose -f docker-compose.traefik.yml up -d
| Endpoint | Format | Example Response |
|---|---|---|
/ | HTML | Interactive web interface with country flags |
/json | JSON | {"IP": "203.0.113.42", "COUNTRY": {"CODE": "DE", "NAME": "Germany"}} |
/raw | Text | 203.0.113.42 |
{
"IP": "203.0.113.42",
"COUNTRY": {
"CODE": "DE",
"NAME": "Germany"
}
}
Note: The
COUNTRYfield is only included when the GeoIP database is available. Without MaxMind credentials, the service works normally but without country detection.
| Subdomain | Description |
|---|---|
ip.example.com | Returns IP based on client connection |
v4.ip.example.com | Forces IPv4 resolution (A record only) |
v6.ip.example.com | Forces IPv6 resolution (AAAA record only) |
Environment variables (see .env.example):
| Variable | Default | Description |
|---|---|---|
STACK_NAME | - | Docker stack identifier (required) |
SERVICE_HOSTNAME | ip.bauer-group.com | Public hostname for the service |
RATE_LIMIT | 480/minute | Request rate limit per client |
TIME_ZONE | UTC | Container timezone |
| Variable | Default | Description |
|---|---|---|
MAXMIND_ACCOUNT_ID | - | MaxMind account ID (register here) |
MAXMIND_LICENSE_KEY | - | MaxMind license key |
GEOIP_UPDATE_FREQUENCY | 168 | Update check interval in hours (168 = weekly, 0 = once) |
| Variable | Default | Description |
|---|---|---|
PROXY_NETWORK | EDGEPROXY | Traefik network name |
Uses docker-compose.yml with direct port mapping:
docker compose up -d
Access via http://localhost:8080 or configure your reverse proxy.
Uses docker-compose.traefik.yml with Traefik labels:
docker compose -f docker-compose.traefik.yml up -d
Includes automatic TLS via Let's Encrypt and CORS headers.
Uses docker-compose.development.yml with hot-reload:
docker compose -f docker-compose.development.yml up -d
ClientPublicIP/
├── src/ # Application source
│ ├── app.py # Flask application (OOP class-based)
│ ├── app.sh # Gunicorn entrypoint
│ ├── Dockerfile # Container definition
│ ├── requirements.txt # Python dependencies
│ └── templates/
│ └── index.html # Web interface with country flags
├── docker-compose.yml # Coolify/Standalone deployment
├── docker-compose.traefik.yml # Traefik deployment
├── docker-compose.development.yml # Development environment
├── .env.example # Environment template
├── .dockerignore # Build exclusions
└── .github/ # CI/CD workflows
ip.example.com → A + AAAA recordsv4.ip.example.com → A record onlyv6.ip.example.com → AAAA record only.env:MAXMIND_ACCOUNT_ID=123456
MAXMIND_LICENSE_KEY=your_license_key
The GeoIP database is stored in a shared Docker volume and automatically updated weekly.
cd src
pip install -r requirements.txt
python app.py
Access at http://localhost:8080
# JSON response with country
curl -s https://ip.example.com/json | jq
# {
# "IP": "203.0.113.42",
# "COUNTRY": {
# "CODE": "DE",
# "NAME": "Germany"
# }
# }
# Plain text (IP only)
curl -s https://ip.example.com/raw
# 203.0.113.42
# Force IPv4
curl -4 https://v4.ip.example.com/raw
# Force IPv6
curl -6 https://v6.ip.example.com/raw
/raw endpointClientPublicIPApp)MIT
Content type
Image
Digest
sha256:4a770283e…
Size
135.5 MB
Last updated
8 months ago
docker pull bauergroup/clientpublicip