Lightweight token-secured Docker agent for mobile server and container monitoring.
2.8K
Token-authenticated Docker monitoring agent for the Docker Monitor mobile app.
Docker Monitor Agent runs as a lightweight container on your Docker host. It connects to Docker through the local Unix socket, exposes a small HTTP API for the mobile app, and adds host-level metrics for CPU, memory, disk, and Docker runtime status. There is no cloud relay and no Docker daemon TCP setup required.
TOKEN="$(openssl rand -hex 32)"
SOCK_GID="$(stat -c '%g' /var/run/docker.sock)"
IMAGE="appleberryd/dockermonitor-agent:0.1.2"
docker rm -f docker-monitor-agent >/dev/null 2>&1 || true
docker run -d \
--name docker-monitor-agent \
--restart unless-stopped \
-p 9876:9876 \
-e AGENT_AUTH_TOKEN="$TOKEN" \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /:/host:ro \
--user 65532:65532 \
--group-add "$SOCK_GID" \
--security-opt no-new-privileges:true \
--read-only \
--tmpfs /tmp \
--memory 128m \
--cpus 0.5 \
"$IMAGE"
echo "AGENT_AUTH_TOKEN=$TOKEN"
Open Docker Monitor on iOS or Android, add a server, use port 9876, and paste the printed AGENT_AUTH_TOKEN.
/agent/stats./agent/health is the only unauthenticated endpoint.--user 65532:65532 plus the Docker socket group.Authorization: Bearer <AGENT_AUTH_TOKEN>.--read-only, --tmpfs /tmp, --security-opt no-new-privileges:true, and CPU/memory limits.The Docker socket is powerful even when mounted read-only. Treat the agent endpoint like infrastructure access: use a strong token, keep it on a private network or behind SSH/VPN, and rotate the token if it is exposed.
If Portainer reports unable to find user root, pull the next fixed image. It includes a minimal root passwd entry for backward compatibility. For the hardened setup, use 65532:65532 and add the Docker socket group.
Public:
GET /agent/healthAuthenticated:
GET /agent/statsGET /versionGET /infoGET /containers/jsonGET /containers/{id}/jsonGET /containers/{id}/logsGET /containers/{id}/statsPOST /containers/{id}/startPOST /containers/{id}/stopPOST /containers/{id}/restartDELETE /containers/{id}GET /images/jsonPOST /images/createDELETE /images/{id}GET /networksGET /volumescurl http://localhost:9876/agent/health
curl -H "Authorization: Bearer $TOKEN" http://localhost:9876/version
curl http://localhost:9876/version
The final command should return 401 Unauthorized.
| Variable | Default | Description |
|---|---|---|
AGENT_PORT | 9876 | Port the agent listens on. |
AGENT_AUTH_TOKEN | required | Bearer token for protected endpoints. |
AGENT_ALLOWED_ORIGIN | empty | Optional CORS allowlist origin. |
AGENT_ALLOW_NO_AUTH | false | Insecure local/testing mode only. |
Content type
Image
Digest
sha256:733054047…
Size
3.3 MB
Last updated
3 months ago
docker pull appleberryd/dockermonitor-agent