Reputation: 503
How can I change my / Prometheus/ Prometheus.yml on the container itself I want it to track 1) my appserver - an Node application in a docker container 2) my postgres db 3) my apached and nginx web server
I do know that one has to change the Prometheus.yml file and add targets
Upvotes: 4
Views: 10752
Reputation: 111
Open the docker container in interactive mode
docker exec -it <container__id> /bin/sh
Then change the prometheus.yml file which should be placed at /etc/prometheus/prometheus.yml
Now, Stop the container and restart the same container. So, now it will read the updated configuration file.
Upvotes: 0
Reputation: 41
Generic mechanisms to change docker images are
Mount your configuration file at the desired path.
Create a new image by copying the co fig file in the new Dockerfile. Not recommended if you have to use different configs for different environments/apps
Change the file on the running container if the application (peomerheus in this case) supports it. I know that some of the apps like Kibana do this. Good for debugging, not recommended for production environments.
Upvotes: 4
Reputation: 21851
It's hard to be precise with an answer given the lack of details but in general, you place your modified prometheus.yml
file within the Docker context and modify your Dockerfile
to add the instruction
COPY prometheus.yml /path/to/prometheus.yml
Upvotes: 1