Share unused bandwidth with AntGain using Docker. Install and start Docker first, then follow the steps below on Linux, macOS, or NAS devices.
Keep your API key private.
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
# 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
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
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
| Variable | Required | Default | Description |
|---|---|---|---|
ANTGAIN_API_KEY | Yes | — | Your AntGain API key from Account Settings. |
ANTGAIN_DEVICE_ID | No | Auto-generated | Fixed unique device UUID. Generated and persisted in the volume automatically if unset. |
ANTGAIN_SKIP_AUTO_UPDATE | No | 0 | Set 1 to disable the in-container startup CLI update check. |
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
AntGain includes a built-in health watchdog that restarts the container if the node cannot connect after the 120-second startup grace period.
curl -I https://api.antgain.app
antgain.env or Docker parameters is correct and has not been revoked.docker run -d --net=host ...
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.
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.
Content type
Image
Digest
sha256:e0f7c1023…
Size
43.8 MB
Last updated
about 2 months ago
docker pull pinors/antgain-cli