Sign inSign up

apertodns/cli

By apertodns

•Updated 9 months ago

Official ApertoDNS CLI tool in Docker

Image
0

1.5K

apertodns/cli repository overview

⁠ApertoDNS CLI Docker Image

Run the official ApertoDNS CLI without installing Node.js locally. Perfect for one-off commands, scripting, and automation.

Docker Image Size Docker Pulls npm version

⁠Alternative: Native npm Install

If you prefer to install the CLI directly without Docker:

# Install globally
npm install -g apertodns

# Use directly
apertodns --setup
apertodns --domains
apertodns --force

See the npm package⁠ for more details.


⁠Features

  • No Node.js required: Run the CLI directly from Docker
  • Multi-architecture: Supports amd64 and arm64
  • Persistent config: Store credentials via volume mount
  • API key support: Use environment variables for CI/CD
  • All CLI features: Full access to ApertoDNS CLI commands

⁠Quick Start

⁠Interactive Setup (First Time)
docker run -it -v apertodns_config:/root/.config/apertodns apertodns/cli --setup

This will prompt you to enter your ApertoDNS credentials and save them to the persistent volume.

⁠List Your Domains
docker run -v apertodns_config:/root/.config/apertodns apertodns/cli --domains
⁠Force Update
docker run -v apertodns_config:/root/.config/apertodns apertodns/cli --force
⁠Standalone Update (No Config Required)
# Update DNS directly with token (no saved config needed)
docker run --rm apertodns/cli --update --domain myhost.apertodns.com --token YOUR_TOKEN

# Specify custom IP
docker run --rm apertodns/cli --update --domain myhost.apertodns.com --token YOUR_TOKEN --ip 1.2.3.4

⁠Using API Key (No Setup Required)

If you have an API key, you can skip the setup and use it directly:

# Via command line argument
docker run apertodns/cli --api-key ak_your_api_key_here --domains

# Via environment variable
docker run -e APERTODNS_API_KEY=ak_your_api_key_here apertodns/cli --domains

⁠All CLI Commands

CommandDescription
--setupInteractive configuration wizard
--domainsList all your domains
--dashboardShow dashboard with statistics
--forceForce update all domains (requires saved config)
--updateStandalone DynDNS2 update (with --domain and --token)
--jsonOutput in JSON format (combine with other commands)
--helpShow all available options

⁠Docker Compose

Create a docker-compose.yml for easy access:

version: '3.8'

services:
  apertodns:
    image: apertodns/cli:latest
    volumes:
      - apertodns_config:/root/.config/apertodns

volumes:
  apertodns_config:

Then use:

# Setup
docker compose run --rm apertodns --setup

# List domains
docker compose run --rm apertodns --domains

# Force update
docker compose run --rm apertodns --force

⁠Shell Alias

Add this to your .bashrc or .zshrc for convenient access:

alias apertodns='docker run -v apertodns_config:/root/.config/apertodns apertodns/cli'

Then use it like a native command:

apertodns --domains
apertodns --force
apertodns --dashboard

⁠CI/CD Integration

⁠GitHub Actions
- name: Update DDNS
  run: |
    docker run \
      -e APERTODNS_API_KEY=${{ secrets.APERTODNS_API_KEY }} \
      apertodns/cli --force
⁠GitLab CI
update_dns:
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker run -e APERTODNS_API_KEY=$APERTODNS_API_KEY apertodns/cli --force
⁠Jenkins Pipeline
stage('Update DNS') {
    steps {
        sh '''
        docker run \
            -e APERTODNS_API_KEY=${APERTODNS_API_KEY} \
            apertodns/cli --force
        '''
    }
}

⁠Scripting Examples

⁠Get domains as JSON
docker run -v apertodns_config:/root/.config/apertodns apertodns/cli --domains --json | jq '.domains[].hostname'
⁠Check specific domain
docker run -e APERTODNS_API_KEY=ak_xxx apertodns/cli --domains --json | jq '.domains[] | select(.hostname=="myhost.apertodns.com")'
⁠Cron job for periodic updates
# Add to crontab
*/5 * * * * docker run --rm -v apertodns_config:/root/.config/apertodns apertodns/cli --force >> /var/log/apertodns.log 2>&1

⁠Environment Variables

VariableDescription
APERTODNS_API_KEYAPI key for authentication (bypasses config file)

⁠Volume Mount

The config file is stored at /root/.config/apertodns/config.json inside the container. Mount a named volume or host path to persist credentials:

# Named volume (recommended)
-v apertodns_config:/root/.config/apertodns

# Host path
-v ~/.config/apertodns:/root/.config/apertodns

⁠Supported Architectures

ArchitectureTag
x86-64amd64
ARM64arm64

All architectures are available via the latest tag with automatic platform selection.

⁠Building Locally

# Clone the repository
git clone https://github.com/1r0n3d3v3l0per/apertodns-docker.git
cd apertodns-docker/cli

# Build for current platform
docker build -t apertodns/cli .

# Build multi-arch
docker buildx build --platform linux/amd64,linux/arm64 \
  -t apertodns/cli:latest --push .

⁠Comparison with Native CLI

FeatureDockerNative (npm)
Node.js requiredNoYes
Installationdocker pullnpm install -g
Updatesdocker pullnpm update -g
Config locationVolume mount~/.config/apertodns
Startup time~100msInstant
Best forCI/CD, containersLocal development

⁠Troubleshooting

⁠Permission denied

If you get permission errors with volume mounts:

# Fix permissions
sudo chown -R $(id -u):$(id -g) ~/.config/apertodns
⁠Config not persisting

Make sure you're using the same volume name:

# Check volumes
docker volume ls | grep apertodns

# Inspect volume
docker volume inspect apertodns_config
⁠Interactive mode not working

For interactive commands like --setup, use -it flags:

docker run -it -v apertodns_config:/root/.config/apertodns apertodns/cli --setup

⁠License

MIT License - see LICENSE⁠ for details.

Tag summary

Content type

Image

Digest

sha256:d1d477193…

Size

71.2 MB

Last updated

9 months ago

docker pull apertodns/cli