Prometheus is not working on local setup

I am trying to enable prometheus metrics endpoint but somehow it always shows us down. I saw the question How to setup prometheus metrics? and I made sure that ip and port are ok but it is still not coming up. My chirpstack-application-server.toml

# Metrics collection settings.
[metrics]
# Timezone
#
# The timezone is used for correctly aggregating the metrics (e.g. per hour,
# day or month).
# Example: "Europe/Amsterdam" or "Local" for the the system's local time zone.
timezone="Local"

  # Metrics stored in Prometheus.
  #
  # These metrics expose information about the state of the ChirpStack Network Server
  # instance.
  [metrics.prometheus]
  # Enable Prometheus metrics endpoint.
  endpoint_enabled=true

  # The ip:port to bind the Prometheus metrics server to for serving the
  # metrics endpoint.
  bind="0.0.0.0:8072"

  # API timing histogram.
  #
  # By setting this to true, the API request timing histogram will be enabled.
  # See also: https://github.com/grpc-ecosystem/go-grpc-prometheus#histograms
  api_timing_histogram=true

Here is my prometheus.yml file

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'chirpstack'
    scrape_interval: 5s
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:8072']

Logs for application server seem to show that metrics server is up

chirpstack-application-server_1 | time=“2020-02-14T00:17:41Z” level=info msg=“metrics: starting prometheus metrics server” bind=“0.0.0.0:8072”

I am using docker-compose up to start the server. The target is showing down on prometheus console. Though app server on localhost:8080 is fine.

Got the problem. I had to expose port 8070 in the docker container. Modified docker-compose.yml and added port mapping 8070:8070. Now it is working.

Hi¡¡

Can you share your configuration.yml in those lines ?? how you exposed the port?

FWIW, if you are using docker, and your prometheus and chirpstack containers share a network, there is no need to expose ports on the containers.