Prometheus TLS with Docker, Web-Conf.yml on Docker?

Hello All,

I am new to the field and I am trying to TLS my Prometheus server locally using docker Image (prom/prometheus), I am unable to load my web-config.yml file using docker.

Is there any way to load web-config.yml when you run/start the container?
Or any other way to locate the web-config file inside prometheus.yml?

Content of my files are basic but I have listed them, I have used the same file installing prometheus directly on my VM and it works.

Thanks in advance!!

web-conf.yml:

tls_server_config:
  cert_file: /etc/prometheus/ssl/temp/localhost.crt
  key_file: /etc/prometheus/ssl/temp/localhost.key
basic_auth_users:
  admin: $2a$12$a2pEmaZPOG8.jho4.f/9t.Qns8XcLtRgtRmzw0yqwM4z7eS5/KH0i

and content of my prometheus.yml:

global:
  scrape_interval:     15s
  evaluation_interval: 15s
scrape_configs:
  - job_name: 'prometheus'

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

When you say you are unable to load the file, what exactly are you meaning? What error are you getting?

How are you running Prometheus? Directly using “docker run” or using docker-compose or some other system? What is the command/config being used?

//I am sorry if my explanation is not good.

I am using promethues by docker run.
Literal command:

docker run \
    -p 9090:9090 \
    -v /path/to/prometheus.yml:/etc/prometheus/prometheus.yml \
    prom/prometheus

I had found that the web-config.yml can be loaded the same way but it’s not working.

I mean there is no option for loading the web-conf for docker as I have researched, Like when you run the container for the first time, you have to select the prometheus.yml file and start the service. Likewise there is no option for loading the web conf; I have also noticed that the TLS settings about the cert and auth are to be put only in the web-conf.yml they dont work when they’re put under prometheus.yml.