MindFlavor / prometheus_wireguard_exporter

A Prometheus exporter for WireGuard, written in Rust.
https://mindflavor.github.io/prometheus_wireguard_exporter
MIT License
463 stars 49 forks source link

How to pass `PROMETHEUS_WIREGUARD_EXPORTER_CONFIG_FILE_NAMES` via docker #113

Closed kramrm closed 6 months ago

kramrm commented 1 year ago

Since Docker runs in a separate environment, I can't reference the wg0.conf file from the host system, and if I map the file as a pass through volume mount, I get a permission issue accessing the config file. How would I pass this in so I can get friendly names while running as a container?

Jodu555 commented 10 months ago

Had the same issue! I used the following docker command to map the dir /etc/wireguard to /wireguard before I gave it Recursive 777 rights!

chmod -R 7777 /etc/wireguard/

To give the dir all permissions

docker run -d --net=host --cap-add=NET_ADMIN --name wgexporter --restart unless-stopped -v /etc/wireguard:/wireguard:ro mindflavor/prometheus-wireguard-exporter -a true -n /wireguard/wg0.conf` 

Then to start the image!!

Worked for me!