All apps · 0 apps
gcp-dynamic-dns
Docker app from johnwesturner's Repository
Overview
Readme
View on GitHubGoogle Cloud Dynamic DNS Client
Note: This is an actively maintained fork of luontola/gcp-dynamic-dns with updated dependencies and modernized GCP SDK.
Automatically sync your public IP address to Google Cloud DNS records. Perfect for home servers, self-hosted services, and dynamic IP environments.
Features
- Multiple IP Detection Methods
- External web service (default)
- Local network interface
- Router via UPnP
- Flexible Authentication
- Environment variable (JSON string)
- Mounted credentials file
- Lightweight
- Minimal Docker image (~10MB)
- Single static binary
- Multi-Architecture
linux/amd64linux/arm64
Table of Contents
Quick Start
docker run -d \
--name gcp-dynamic-dns \
--network host \
--restart always \
-e DNS_NAMES="example.com." \
-e GOOGLE_PROJECT="your-project-id" \
-e GOOGLE_CREDENTIALS_JSON='{"type":"service_account",...}' \
b1tsized/gcp-dynamic-dns sync
Installation
Docker Compose
services:
dyndns:
image: b1tsized/gcp-dynamic-dns
container_name: gcp-dynamic-dns
command: sync
network_mode: host
restart: always
environment:
DNS_NAMES: example.com. www.example.com.
GOOGLE_PROJECT: your-project-123456
# Option 1: Credentials as JSON string (recommended)
GOOGLE_CREDENTIALS_JSON: '{"type":"service_account","project_id":"..."}'
# Option 2: Credentials as file
# GOOGLE_APPLICATION_CREDENTIALS: /gcp-keys.json
# volumes:
# - ./gcp-keys.json:/gcp-keys.json:ro
UnRaid
Click to expand UnRaid installation guide
Adding the Container
- In UnRaid's Docker tab, click Add Container
- Configure:
| Field | Value |
|---|---|
| Name | gcp-dynamic-dns |
| Repository | b1tsized/gcp-dynamic-dns |
| Network Type | host |
| Post Arguments | sync |
| Restart Policy | always |
Environment Variables
| Variable | Value |
|---|---|
DNS_NAMES |
yourdomain.com. (must end with .) |
GOOGLE_PROJECT |
Your GCP project ID |
GOOGLE_CREDENTIALS_JSON |
Your service account JSON |
Verifying It Works
Check the container logs. You should see:
Using credentials from GOOGLE_CREDENTIALS_JSON environment variable
Current IP: 203.0.113.42
Updated DNS: example.com. A -> 203.0.113.42
Configuration
Authentication
Two methods are supported for GCP credentials:
Option 1: Environment Variable (Recommended)
Pass the entire service account JSON as an environment variable:
environment:
GOOGLE_CREDENTIALS_JSON: '{"type":"service_account","project_id":"...","private_key":"..."}'
Pros: No file mounts, works great with container orchestrators
Option 2: File Mount
Mount the JSON key file into the container:
environment:
GOOGLE_APPLICATION_CREDENTIALS: /gcp-keys.json
volumes:
- /path/to/credentials.json:/gcp-keys.json:ro
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
DNS_NAMES |
Yes | - | Space-separated DNS names (must end with .) |
GOOGLE_PROJECT |
Yes | - | GCP project ID |
GOOGLE_CREDENTIALS_JSON |
* | - | Service account JSON content |
GOOGLE_APPLICATION_CREDENTIALS |
* | - | Path to credentials file |
MODE |
No | service |
IP detection mode (see below) |
SERVICE_URLS |
No | [see below] | Custom IP detection URLs |
INTERFACE_NAME |
No | auto | Network interface name |
* One of GOOGLE_CREDENTIALS_JSON or GOOGLE_APPLICATION_CREDENTIALS is required
IP Detection Modes
| Mode | Description |
|---|---|
service |
Query external web services (default) |
interface |
Read from local network interface |
upnp |
Query router via UPnP protocol |
Note: Modes
interfaceandupnprequirenetwork_mode: host
Default Service URLs
https://ipv4.icanhazip.com/
https://checkip.amazonaws.com/
https://ifconfig.me/ip
https://ipinfo.io/ip
Services are queried in round-robin fashion every 5 minutes.
GCP Setup
Create a service account
- Name:
dns-updater - Role: DNS Administrator (
roles/dns.admin)
- Name:
Create a JSON key
- Click on the service account
- Keys → Add Key → Create new key → JSON
- Download and save securely
Ensure DNS records exist
- Records must already exist in Cloud DNS
- Must be type
Arecords - Names must end with
.(e.g.,example.com.)
Development
Prerequisites
Local Development
# Run tests
cd src/app
go test -v ./...
# Build binary
go build -o ../../app
# Run locally
DNS_NAMES="example.com." GOOGLE_PROJECT="test" ./app list-ip
Docker Build
# Build image
docker build -t b1tsized/gcp-dynamic-dns .
# Test container
docker run --rm b1tsized/gcp-dynamic-dns help
CI/CD
| Workflow | Trigger | Action |
|---|---|---|
| CI | Push/PR to main |
Run tests, build |
| Release | GitHub Release | Build & push to Docker Hub |
Creating a Release
- Go to Releases → Create a new release
- Create tag:
v2.0.0(semantic versioning) - Click Publish release
The workflow automatically builds multi-arch images and pushes:
b1tsized/gcp-dynamic-dns:latestb1tsized/gcp-dynamic-dns:2.0.0b1tsized/gcp-dynamic-dns:2.0b1tsized/gcp-dynamic-dns:2
Repository Secrets
Required for releases:
| Secret | Description |
|---|---|
DOCKERHUB_USERNAME |
Docker Hub username |
DOCKERHUB_TOKEN |
Docker Hub access token |
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Changes from Upstream
This fork includes:
- Updated to Go 1.25
- Updated all dependencies to latest versions
- Modernized GCP SDK (
dns.NewService()instead of deprecateddns.New()) - Narrower OAuth scope (
NdevClouddnsReadwriteScope) - New:
GOOGLE_CREDENTIALS_JSONenvironment variable support - New: Multi-architecture Docker images (amd64/arm64)
- New: GitHub Actions CI/CD
- Code quality improvements
License
Original work Copyright © 2023 Esko Luontola
Install gcp-dynamic-dns on Unraid in a few clicks.
Find gcp-dynamic-dns in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.
Categories
Download Statistics
Related apps
Explore more like this
Explore allDetails
b1tsized/gcp-dynamic-dnsRuntime arguments
- Network
host- Shell
sh- Privileged
- false
Template configuration
Space-separated DNS names to update (must end with period, e.g., example.com.)
Your Google Cloud Platform project ID
Service account JSON content (paste entire JSON key file content)
IP detection mode: service (external web services), interface (local network interface), or upnp (query router)
- Default
- service
Network interface name (only used when MODE=interface)