discourse / prometheus_exporter

A framework for collecting and aggregating prometheus metrics
MIT License
538 stars 156 forks source link

Error running prometheus_exporter in docker container #189

Closed bgmat closed 2 years ago

bgmat commented 3 years ago

Hello

I'm trying to start prometheus_exporter with -b 0.0.0.0, in a docker container. I get this error.

remote:        /usr/local/lib/ruby/2.6.0/socket.rb:227:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)
remote:         from /usr/local/lib/ruby/2.6.0/socket.rb:227:in `foreach'
remote:         from /usr/local/lib/ruby/2.6.0/socket.rb:762:in `tcp_server_sockets'
remote:         from /usr/local/lib/ruby/2.6.0/webrick/utils.rb:65:in `create_listeners'
remote:         from /usr/local/lib/ruby/2.6.0/webrick/server.rb:127:in `listen'
remote:         from /usr/local/lib/ruby/2.6.0/webrick/server.rb:108:in `initialize'
remote:         from /usr/local/lib/ruby/2.6.0/webrick/httpserver.rb:47:in `initialize'
remote:         from /usr/local/bundle/gems/prometheus_exporter-0.8.1/lib/prometheus_exporter/server/web_server.rb:47:in `new'
remote:         from /usr/local/bundle/gems/prometheus_exporter-0.8.1/lib/prometheus_exporter/server/web_server.rb:47:in `initialize'
remote:         from /usr/local/bundle/gems/prometheus_exporter-0.8.1/lib/prometheus_exporter/server/runner.rb:45:in `new'
remote:         from /usr/local/bundle/gems/prometheus_exporter-0.8.1/lib/prometheus_exporter/server/runner.rb:45:in `start'
remote:         from /usr/local/bundle/gems/prometheus_exporter-0.8.1/bin/prometheus_exporter:122:in `run'
remote:         from /usr/local/bundle/gems/prometheus_exporter-0.8.1/bin/prometheus_exporter:126:in `<top (required)>'
remote:         from /usr/local/bundle/bin/prometheus_exporter:23:in `load'
remote:         from /usr/local/bundle/bin/prometheus_exporter:23:in `<main>'
remote:        2021-10-29 14:39:23 +0000 Starting prometheus exporter on  0.0.0.0:9394

The container is built using this Dockerfile:

FROM ruby:2.6.6

RUN gem install prometheus_exporter

WORKDIR /app
EXPOSE 9394

CMD ["-v","-b 0.0.0.0"]
ENTRYPOINT ["/usr/local/bundle/bin/prometheus_exporter"]

Has anyone seen this?

Thank you

bgmat commented 2 years ago

I got help on Stackoverflow. The issue was in the CMD line in Dockerfile. The correct version: CMD ["-v","-b","0.0.0.0"]