Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload not working with docker #2544

Closed
Xaelias opened this Issue Mar 29, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@Xaelias
Copy link

Xaelias commented Mar 29, 2017

Hi guys!

So I've been running Prometheus in a docker on my nas since yesterday, so I'm still trying things, and changing the config a lot.

Thing is, as of now, I don't seem to be able to reload the config, except if I restart the container.
It's not that big of a deal in itself, but it's irritating...

So I tried:
curl -XPOST localhost:9090/-/reload from the nas itself.
And I also tried to attach a shell to the container and do a:
kill -HUF 1 # 1 being the pid of prometheus, grabbed from ps

In both cases, the only thing I see in the logs is:

time="2017-03-29T00:36:41Z" level=info msg="Loading configuration file /etc/prometheus/prometheus.yml" source="main.go:248"

Nothing more, nothing less. The config (grabbed from curl localhost:9090/config or in the UI itself) don't change, and the changes don't take effect AFAIK.

Am I missing something?
Is it specific to running prometheus in a container?

Thanks :-)

@brancz

This comment has been minimized.

Copy link
Member

brancz commented Mar 30, 2017

Did you directly mount the file into the docker container instead of the directory? Because when mounting single files into a docker container, they cannot be updated from the outside.

@Xaelias

This comment has been minimized.

Copy link
Author

Xaelias commented Mar 30, 2017

I did mount the file, but when doing a docker cp I was able to see the updated file.
I'll double check next time I update it (might not have time before next week now) and test with the file and the directory.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Mar 30, 2017

Yeah, you have to mount in the entire directory, otherwise Prometheus will not see any changes. 99% certain that's the issue here and we've seen it before, so closing. Please reopen in case there is a different reason.

@juliusv juliusv closed this Mar 30, 2017

@Xaelias

This comment has been minimized.

Copy link
Author

Xaelias commented Apr 24, 2017

Finally got around to testing this! Just wanted to confirm that indeed, after mounting the entire directory, the reload now works.

Thanks guys :-)

@apakhomov

This comment has been minimized.

Copy link

apakhomov commented Dec 7, 2018

In my case mounting the whole directory is inconvenient. Why it's impossible to always use inotifywatch of config.file specified at startup? I divide different configs in subdirectories in /etc/prometheus and they are being mounted from different sources. Mounting the whole /etc/prometheus for the only prometheus.yml causes headake

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Dec 10, 2018

@apakhomov Note that this is not a Prometheus issue, but a Docker issue. When you mount in a single file into a container, the container will not see any updates to it, so there's nothing that Prometheus can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.