HUB
Sign inSign up

pinors/antgain-cli

By pinors

•Updated about 2 months ago

Image
0

100K+

pinors/antgain-cli repository overview

⁠AntGain Node for Docker

Share unused bandwidth with AntGain using Docker. Install and start Docker first, then follow the steps below on Linux, macOS, or NAS devices.


⁠1. Get your API key

  1. Sign up or sign in at AntGain⁠.
  2. Open Account Settings⁠ and find API Key.
  3. Copy your key. If you do not have one yet, click Generate API Key first.

Keep your API key private.


⁠2. Quick Start (One-Liner)

Run the following command in your terminal, replacing YOUR_API_KEY with your actual key:

docker run -d \
  --name antgain-node \
  --restart unless-stopped \
  --stop-timeout 30 \
  --health-cmd="antgain health || exit 1" \
  --health-interval=30s \
  --health-timeout=5s \
  --health-start-period=120s \
  --health-retries=3 \
  -e ANTGAIN_API_KEY="YOUR_API_KEY" \
  -v antgain-data:/data/.antgain \
  pinors/antgain-cli:latest

Docker will download the image and start AntGain in the background. The device identity is generated automatically and saved in the antgain-data volume. Keep this volume across restarts or updates.

Tip: Allow up to two minutes for the initial connection and startup checks. Check the status using docker logs -f antgain-node.


Using an environment file avoids leaving your API key in your shell history or process list:

mkdir -p antgain-docker && cd antgain-docker

# 1. Save your API key securely
cat > antgain.env <<'EOF_KEY'
ANTGAIN_API_KEY=YOUR_API_KEY_HERE
EOF_KEY
chmod 600 antgain.env

# 2. Start the container
docker run -d \
  --name antgain-node \
  --restart unless-stopped \
  --stop-timeout 30 \
  --health-cmd="antgain health || exit 1" \
  --health-interval=30s \
  --health-timeout=5s \
  --health-start-period=120s \
  --health-retries=3 \
  --env-file ./antgain.env \
  -v antgain-data:/data/.antgain \
  pinors/antgain-cli:latest

⁠4. Check Your Node & Everyday Commands

# View real-time logs (Ctrl+C to exit)
docker logs -f antgain-node

# View recent output
docker logs --tail 100 antgain-node

# Check connection and health status
docker exec antgain-node antgain health

# View Docker health state: starting, healthy, or unhealthy
docker inspect --format '{{.State.Health.Status}}' antgain-node

# Stop / Start / Restart container
docker stop antgain-node
docker start antgain-node
docker restart antgain-node

# Show installed client version
docker exec antgain-node antgain --version
⁠Update the Docker image

Automatic client updates run inside the container. To refresh the base Docker image as well, run:

docker pull pinors/antgain-cli:latest
docker stop antgain-node
docker rm antgain-node

# Recreate container using the same data volume
docker run -d \
  --name antgain-node \
  --restart unless-stopped \
  --stop-timeout 30 \
  --health-cmd="antgain health || exit 1" \
  --health-interval=30s \
  --health-timeout=5s \
  --health-start-period=120s \
  --health-retries=3 \
  --env-file ./antgain.env \
  -v antgain-data:/data/.antgain \
  pinors/antgain-cli:latest

⁠5. Docker Compose (Optional)

In your antgain-docker folder, keep antgain.env and create compose.yaml:

services:
  antgain-node:
    image: pinors/antgain-cli:latest
    container_name: antgain-node
    restart: unless-stopped
    stop_grace_period: 30s
    healthcheck:
      test: ["CMD-SHELL", "antgain health || exit 1"]
      interval: 30s
      timeout: 5s
      start_period: 120s
      retries: 3
    env_file:
      - ./antgain.env
    volumes:
      - antgain-data:/data/.antgain

volumes:
  antgain-data:
    name: antgain-data

Start the container:

docker compose up -d

Useful Compose commands:

# Follow logs
docker compose logs -f antgain-node

# Update image and recreate container
docker compose pull
docker compose up -d --force-recreate

⁠6. Environment Variables

VariableRequiredDefaultDescription
ANTGAIN_API_KEYYes—Your AntGain API key from Account Settings.
ANTGAIN_DEVICE_IDNoAuto-generatedFixed unique device UUID. Generated and persisted in the volume automatically if unset.
ANTGAIN_SKIP_AUTO_UPDATENo0Set 1 to disable the in-container startup CLI update check.

⁠7. Optional: Set Custom Device ID

You normally do not need to do this. The client automatically generates and persists a UUID.

If you need a specific UUID before starting a new node, generate one:

docker run --rm --entrypoint cat pinors/antgain-cli:latest /proc/sys/kernel/random/uuid

Add it to antgain.env:

printf 'ANTGAIN_DEVICE_ID=%s\n' 'PASTE_UUID_HERE' >> antgain.env

⁠8. Troubleshooting

⁠Q1: Container keeps restarting ("Docker node stayed unhealthy; exiting for container restart")

AntGain includes a built-in health watchdog that restarts the container if the node cannot connect after the 120-second startup grace period.

  • Check Internet Connectivity: Make sure your host machine can reach the AntGain API:
    curl -I https://api.antgain.app
    
  • Verify API Key: Confirm your API key in antgain.env or Docker parameters is correct and has not been revoked.
  • DNS or Routing on NAS (Synology, QNAP, Unraid): Docker's default bridge network may fail to resolve external domains or route QUIC traffic on certain NAS network interfaces. Try using host network mode:
    docker run -d --net=host ...
    
⁠Q2: "Error: Update failed: cli/latest.json failed"

This means the container could not reach the update CDN (https://cdn.iprobe.io). AntGain will automatically fall back to the image's built-in binary and continue running. To suppress this check entirely, add -e ANTGAIN_SKIP_AUTO_UPDATE=1 to your docker run command or antgain.env.

⁠Q3: Node device ID changes on every restart

Make sure you have mounted the persistent volume -v antgain-data:/data/.antgain. If the volume is omitted, a new node identity is generated each time the container is recreated.


⁠Need help?

Tag summary

Content type

Image

Digest

sha256:e0f7c1023…

Size

43.8 MB

Last updated

about 2 months ago

docker pull pinors/antgain-cli