A Prometheus exporter that receives StatsD-style metrics and exports them as Prometheus metrics via configurable mapping rules and tagging formats.
Pull the latest version of this image from the Ghost registry. Pulling requires authentication — generate a token and run docker login first (see Authentication below).
The Ghost catalog is public to browse, but pulling images requires an account. Generate a pull token below (or from your Account → Tokens page) — you'll get a ready-to-paste docker login command, then docker pull works.
The username is generated automatically (it looks like robot$<project>+<auto-id>, not the name you typed) and is included in the docker login command above. The secret is shown only once when you create the token.
All Ghost images are signed with cosign. Verifying the signature before deployment ensures the image has not been tampered with.
Install cosign via brew install cosign or download from the Sigstore releases page.
Reference this image in your Dockerfile as a base layer:
This is a vendor-built FIPS-enabled image: its cryptography runs on FIPS 140-3 validated modules configured by the upstream vendor. You can inspect the image metadata:
| Standard | FIPS 140-3 |
| Crypto module | Vendor-configured validated modules |
| Cryptography | Validated modules only |
| Use case | Government, regulated industries, compliance workloads |
All examples in this guide use the public image. If you've mirrored the repository for your own use (for example, to your Docker Hub namespace), update your commands to reference the mirrored image instead of the public one.
For example:
registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag><your-namespace>/dhi-prometheus-statsd-exporter:<tag>For the examples, you must first use docker login registry.ghost-prod.alphabravo.io to authenticate to the registry to pull the images.
This guide provides practical examples for using the Prometheus StatsD Exporter Hardened Image for metrics collection and transformation.
This Docker Hardened StatsD Exporter image provides the Prometheus StatsD Exporter in three variants:
docker run -d \
--name statsd-exporter \
-p 9102:9102 \
-p 9125:9125/udp \
registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag>
This starts the exporter to listen for StatsD metrics on UDP port 9125 and expose Prometheus metrics at
http://localhost:9102/metrics.
To configure StatsD Exporter with custom ports and paths:
docker run -d \
--name statsd-exporter \
-p 8080:8080 \
-p 8125:8125/udp \
registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag> \
--web.listen-address=0.0.0.0:8080 \
--web.telemetry-path=/custom-metrics \
--statsd.listen-udp=0.0.0.0:8125
To use a mapping configuration file to transform StatsD metrics into meaningful Prometheus metrics:
docker run -d \
--name statsd-exporter \
-p 9102:9102 \
-p 9125:9125/udp \
-v /path/to/statsd-mapping.yml:/etc/statsd-mapping.yml:ro \
registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag> \
--statsd.mapping-config=/etc/statsd-mapping.yml
Example mapping configuration (statsd-mapping.yml):
---
mappings:
- match: test.dispatcher.*.*.*
name: dispatcher_events
labels:
processor: $1
action: $2
outcome: $3
- match: test.*.count
name: ${1}_total
labels:
job: test-service
You can also configure StatsD Exporter using environment variables:
docker run -d \
--name statsd-exporter \
-p 9102:9102 \
-p 9125:9125/udp \
-e STATSD_EXPORTER_WEB_LISTEN_ADDRESS=0.0.0.0:9102 \
-e STATSD_EXPORTER_WEB_TELEMETRY_PATH=/metrics \
-e STATSD_EXPORTER_STATSD_LISTEN_UDP=0.0.0.0:9125 \
registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag>
Create a directory structure:
$ mkdir -p statsd-dhi-test
$ cd statsd-dhi-test
Create the mapping configuration file:
cat <<EOF > statsd-mapping.yml
---
mappings:
- match: app.requests.*.*
name: app_requests_total
labels:
endpoint: \$1
method: \$2
- match: app.response_time.*
name: app_response_time_seconds
labels:
endpoint: \$1
EOF
Create Docker Compose file:
cat <<EOF > docker-compose.yml
services:
statsd-exporter:
image: registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag>
ports:
- "9102:9102"
- "9125:9125/udp"
volumes:
- ./statsd-mapping.yml:/etc/statsd-mapping.yml:ro
command:
- --statsd.mapping-config=/etc/statsd-mapping.yml
- --statsd.cache-size=2000
restart: unless-stopped
EOF
Start the stack:
$ docker compose up -d
Verify the metrics endpoint:
$ curl http://localhost:9102/metrics
# HELP statsd_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which statsd_exporter was built.
# TYPE statsd_exporter_build_info gauge
statsd_exporter_build_info{...} 1
For production-like setups with Prometheus scraping the StatsD Exporter:
cat <<EOF > docker-compose.yml
services:
statsd-exporter:
image: registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag>
ports:
- "9102:9102"
- "9125:9125/udp"
volumes:
- ./statsd-mapping.yml:/etc/statsd-mapping.yml:ro
command:
- --statsd.mapping-config=/etc/statsd-mapping.yml
restart: unless-stopped
prometheus:
image: registry.ghost-prod.alphabravo.io/ghost-base/prometheus:<tag>
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
tmpfs:
- /prometheus:uid=65532,gid=65532
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
depends_on:
- statsd-exporter
EOF
Note: The DHI Prometheus image runs as nonroot (UID 65532). Using
tmpfswith the correct uid/gid ensures the container can write to the data directory. For persistent storage, create a volume with appropriate ownership.
Create Prometheus configuration:
cat <<EOF > prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'statsd-exporter'
static_configs:
- targets: ['statsd-exporter:9102']
EOF
Start the full stack:
$ docker compose up -d
Verify all services are running:
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
statsd-dhi-test-prometheus-1 registry.ghost-prod.alphabravo.io/ghost-base/prometheus:<tag> "prometheus --config…" prometheus 6 seconds ago Up 5 seconds 0.0.0.0:9090->9090/tcp
statsd-dhi-test-statsd-exporter-1 registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag> "/usr/local/bin/stat…" statsd-exporter 6 seconds ago Up 5 seconds 0.0.0.0:9102->9102/tcp, 0.0.0.0:9125->9125/udp
Verify Prometheus is healthy and scraping:
$ curl -s http://localhost:9090/-/healthy
Prometheus Server is Healthy.
$ curl -s http://localhost:9090/api/v1/targets | grep '"health"'
"health":"up"
Once StatsD Exporter is running, you can send metrics from your applications using any StatsD client:
# Counter
echo "api.requests:1|c" | nc -u -w1 localhost 9125
# Gauge
echo "cpu.usage:75.5|g" | nc -u -w1 localhost 9125
# Timer
echo "api.response_time:150|ms" | nc -u -w1 localhost 9125
# Histogram
echo "request.size:1024|h" | nc -u -w1 localhost 9125
# With tags (DogStatsD format)
echo "api.requests:1|c|#endpoint:users,method:GET" | nc -u -w1 localhost 9125
The metrics will be converted to Prometheus format and available at the /metrics endpoint.
To use the StatsD Exporter hardened image in Kubernetes, set up authentication and update your Kubernetes deployment.
cat <<EOF > statsd-exporter.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: statsd-mapping
namespace: default
data:
statsd-mapping.yml: |
---
mappings:
- match: app.requests.*.*
name: app_requests_total
labels:
endpoint: \$1
method: \$2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: statsd-exporter
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: statsd-exporter
template:
metadata:
labels:
app: statsd-exporter
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9102"
spec:
containers:
- name: statsd-exporter
image: registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag>
args:
- --statsd.mapping-config=/etc/statsd-mapping/statsd-mapping.yml
ports:
- containerPort: 9102
name: metrics
- containerPort: 9125
protocol: UDP
name: statsd
volumeMounts:
- name: statsd-mapping
mountPath: /etc/statsd-mapping
readOnly: true
volumes:
- name: statsd-mapping
configMap:
name: statsd-mapping
imagePullSecrets:
- name: <your-registry-secret>
---
apiVersion: v1
kind: Service
metadata:
name: statsd-exporter
namespace: default
spec:
ports:
- port: 9102
targetPort: 9102
name: metrics
- port: 9125
targetPort: 9125
protocol: UDP
name: statsd
selector:
app: statsd-exporter
EOF
Then apply the manifest to your Kubernetes cluster:
$ kubectl apply -n default -f statsd-exporter.yaml
Verify the deployment:
$ kubectl get pods -l app=statsd-exporter
NAME READY STATUS RESTARTS AGE
statsd-exporter-7d8f9c6b4d-xyz12 1/1 Running 0 30s
Access the metrics endpoint:
$ kubectl port-forward -n default deployment/statsd-exporter 9102:9102
Then visit http://localhost:9102/metrics in your browser.
For examples of how to configure StatsD Exporter itself, see the Prometheus StatsD Exporter documentation.
| Feature | Non-hardened StatsD Exporter | Docker Hardened StatsD Exporter |
|---|---|---|
| Base image | Debian/Alpine with full utilities | Debian hardened base |
| Security | Standard image with basic utilities | Hardened build with security patches and security metadata |
| Shell access | Shell (/bin/sh) available | No shell (runtime variants) |
| Package manager | Package manager available | No package manager (runtime variants) |
| User | Runs as root or specified user | Runs as nonroot user |
| Attack surface | Full OS utilities and tools | Only StatsD Exporter binary, no additional utilities |
| Debugging | Full shell and utilities | Use Docker Debug or image mount for troubleshooting |
Ghost hardened images prioritize security through minimalism:
The hardened images intended for runtime don't contain a shell nor any tools for debugging. Common debugging methods for applications built with Ghost hardened images include:
Docker Debug provides a shell, common debugging tools, and lets you install other tools in an ephemeral, writable layer that only exists during the debugging session.
For example, you can use Docker Debug:
$ docker run -d --name statsd-test registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag>
$ docker debug statsd-test
Inside the debug session:
docker > cat /etc/os-release
NAME="Ghost hardened images (Debian)"
ID=debian
VERSION_ID=13
VERSION_CODENAME=trixie
PRETTY_NAME="Ghost hardened images/Debian GNU/Linux 13 (trixie)"
Ghost hardened images come in different variants depending on their intended use. Image variants are identified by their tag.
Runtime variants are designed to run your application in production. These images are intended to be used either
directly or as the FROM image in the final stage of a multi-stage build. These images typically:
Dev variants include dev in the tag name and are intended for use in the first stage of a multi-stage Dockerfile.
These images typically:
FIPS variants include fips in the variant name and tag. They come in both runtime and build-time variants. These
variants use cryptographic modules that have been validated under FIPS 140, a U.S. government standard for secure
cryptographic operations. Docker Hardened StatsD Exporter images include FIPS-compliant variants for environments
requiring Federal Information Processing Standards compliance.
# Compare image sizes (FIPS variants are larger due to FIPS crypto libraries)
$ docker images | grep statsd-exporter
registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter <tag> 4.96 MB
registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter <tag>-fips 16.75 MB
# Verify FIPS compliance using image labels
$ docker inspect registry.ghost-prod.alphabravo.io/ghost-base/prometheus-statsd-exporter:<tag>-fips \
--format '{{index .Config.Labels "com.docker.dhi.compliance"}}'
fips
To view the image variants and get more information about them, select the Tags tab for this repository, and then select a tag.
To migrate your application to a Ghost hardened image, you must update your Dockerfile. At minimum, you must update the base image in your existing Dockerfile to a Ghost hardened image. This and a few other common changes are listed in the following table of migration notes:
| Item | Migration note |
|---|---|
| Base image | Replace your base images in your Dockerfile with a Ghost hardened image. |
| Package management | Non-dev images, intended for runtime, don't contain package managers. Use package managers only in images with a dev tag. |
| Non-root user | By default, non-dev images, intended for runtime, run as a nonroot user. Ensure that necessary files and directories are accessible to the nonroot user. |
| Multi-stage build | Utilize images with a dev tag for build stages and non-dev images for runtime. For binary executables, use a static image for runtime. |
| TLS certificates | Ghost hardened images contain standard TLS certificates by default. There is no need to install TLS certificates. |
| Ports | Non-dev hardened images run as a nonroot user by default. As a result, applications in these images can't bind to privileged ports (below 1024) when running in Kubernetes or in Docker Engine versions older than 20.10. To avoid issues, configure your application to listen on port 1025 or higher inside the container. |
| Entry point | Ghost hardened images may have different entry points than images such as Docker Official Images. Inspect entry points for Ghost hardened images and update your Dockerfile if necessary. |
| No shell | By default, non-dev images, intended for runtime, don't contain a shell. Use dev images in build stages to run shell commands and then copy artifacts to the runtime stage. |
The following steps outline the general migration process.
Find hardened images for your app.
A hardened image may have several variants. Inspect the image tags and find the image variant that meets your needs.
Update the base image in your Dockerfile.
Update the base image in your application's Dockerfile to the hardened image you found in the previous step.
For multi-stage Dockerfiles, update the runtime image in your Dockerfile.
To ensure that your final image is as minimal as possible, you should use a multi-stage build. All stages in your Dockerfile should use a hardened image. While intermediary stages will typically use images tagged as dev, your final runtime stage should use a non-dev image variant.
Install additional packages
Ghost hardened images contain minimal packages in order to reduce the potential attack surface. You may need to install additional packages in your Dockerfile. Inspect the image variants to identify which packages are already installed.
Only images tagged as dev typically have package managers. You should use a multi-stage Dockerfile to install the packages. Install the packages in the build stage that uses a dev image. Then, if needed, copy any necessary artifacts to the runtime stage that uses a non-dev image.
For Alpine-based images, you can use apk to install packages. For Debian-based images, you can use apt-get to install packages.
The hardened images intended for runtime don't contain a shell nor any tools for debugging. The recommended method for debugging applications built with Ghost hardened images is to use Docker Debug to attach to these containers. Docker Debug provides a shell, common debugging tools, and lets you install other tools in an ephemeral, writable layer that only exists during the debugging session.
By default image variants intended for runtime, run as a nonroot user. Ensure that necessary files and directories are accessible to that user. You may need to copy files to different directories or change permissions so your application running as a nonroot user can access them.
To view the user for an image variant, select the Tags tab for this repository.
Non-dev hardened images run as a nonroot user by default. As a result, applications in these images can't bind to
privileged ports (below 1024) when running in Kubernetes or in Docker Engine versions older than 20.10. To avoid issues,
configure your application to listen on port 1025 or higher inside the container, even if you map it to a lower port on
the host. For example, docker run -p 80:8080 my-image will work because the port inside the container is 8080, and
docker run -p 80:81 my-image won't work because the port inside the container is 81.
By default, image variants intended for runtime don't contain a shell. Use dev images in build stages to run shell
commands and then copy any necessary artifacts into the runtime stage. In addition, use Docker Debug to debug containers
with no shell.
To see if a shell is available in an image variant and which one, select the Tags tab for this repository.
Ghost hardened images may have different entry points than images such as Docker Official Images. Use docker inspect
to inspect entry points for Ghost hardened images and update your Dockerfile if necessary.
To view the Entrypoint or CMD defined for an image variant, select the Tags tab for this repository, select a tag, and then select the Specifications tab.