Sign inSign up

oitc/dockerhubstats2mqtt

By oitc

Updated 3 months ago

Collect repository statistics from Dockerhub and publish them to a MQTT topic.

Image
Developer tools
Monitoring & observability
Web analytics
0

2.4K

oitc/dockerhubstats2mqtt repository overview

Quick reference

References

Maintained by: Michael Oberdorf IT-Consulting

Source code: GitHub

Container image: DockerHub

Summary

The container image is based on Alpine Linux and sends a curl request result with the mosquitto-client to a MQTT server topic.

Prerequisites to run the docker container

You need an MQTT server to send the data to it.

Configuration

Container configuration

The container grab the configuration via environment variables.

Environment variable nameDescriptionRequiredDefault value
MQTT_SERVERThe MQTT server hostname or IP addressOPTIONALlocalhost
MQTT_PORTThe TCP port of the MQTT serverOPTIONAL1883
MQTT_TLS_enabledShould SSL communication be enabled (true) or not (false)OPTIONALfalse
MQTT_CACERT_FILEIf TLS is enabled, the path to the CA certificate file to validate the MQTT server certificateOPTIONAL
MQTT_TLS_no_hostname_validationIf TLS is enabled, skip the hostname validation of the TLS certificateOPTIONALfalse
MQTT_USERThe MQTT username for MQTT authenticationOPTIONAL
MQTT_PASSWORDThe MQTT password for MQTT authenticationOPTIONAL
MQTT_PASSWORD_FILEThe filepath where the MQTT password is stored for MQTT authenticationOPTIONAL
MQTT_TOPICThe MQTT topic to send the docker hub statistics toMANDATORY
MQTT_RETAINSet the retain flag when publishing the docker hub statistics to MQTT topicOPTIONALfalse
REPOSITORIESA whitespace separated list of docker hub repositories where to collect the statisticsMANDATORY
MQTT_TOPIC_REPO_EXTENSIONUse the docker hub repository name as MQTT topic appendixOPTIONALfalse

Docker compose configuration

services:
  dockerhubstats2mqtt:
    restart: "no"
    user: 5241:5241
    image: oitc/dockerhubstats2mqtt:latest
    environment:
      MQTT_SERVER: test.mosquitto.org
      MQTT_PORT: 1883
      MQTT_TOPIC: com/docker/hub/repositories/metrics
      REPOSITORIES: oitc/dockerhubstats2mqtt oitc/modbus-server oitc/mqtt2elasticsearch

A bigger example can be found here: docker-compose.yaml

Relationship to docker.mqtt2elasticsearch

If you want to use docker.mqtt2elasticsearch to store the data in an Elasticsearch or Opensearch database, ou can use this mappings example file:

mqtt2elasticsearch-mappings.json

Donate

I would appreciate a small donation to support the further development of my open source projects.

Donate with PayPal

License

Copyright (c) 2025-2026 Michael Oberdorf IT-Consulting

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Tag summary

Content type

Image

Digest

sha256:f4b1c3329

Size

7.5 MB

Last updated

3 months ago

docker pull oitc/dockerhubstats2mqtt