Podman volume - Permission denied
Recently I was using podman and started prometheus and was unpleasantly surprised with the following errors:
ts=2022-07-13T06:35:38.724Z caller=query_logger.go:113 level=error component=activeQueryTracker msg="Failed to create directory for logging active queries"
ts=2022-07-13T06:35:38.724Z caller=query_logger.go:91 level=error component=activeQueryTracker msg="Error opening query log file" file=/prometheus/data/queries.active err="open data/queries.active: no such file or directory"
panic: Unable to create mmap-ed active query log
goroutine 1 [running]:
github.com/prometheus/prometheus/promql.NewActiveQueryTracker({0x336d549, 0x5}, 0x14, {0x3d8ba20, 0xc0004e3590})
/app/promql/query_logger.go:121 +0x3cd
main.main()
/app/cmd/prometheus/main.go:618 +0x69d3
exit code: 2
At first I focused on the mmap-ed
panic message, but that was the result of an earlier error. Although I did not get a permission denied error, I found this error quite strange: Failed to create directory for logging active queries
.
Then I started looking around and found an old thread on github. After reading it, I re-examined my docker-compose
file and still did not find anything weird. The data volume was created (and I was used to it having the correct permissions).
After checking the volume out (by mounting it in another container), I found that the permissions were wrong indeed. The /prometheus
mountpoint was root:root
and 755
. After a chown
to nobody:nobody
, it all worked fine.