Try:
prometheus:
container_name: prometheus
image: "prom/prometheus:latest"
user: "1000"
networks:
- observability
ports:
- "9090:9090"
volumes:
- ./prometheus:/etc/prometheus
- /data/prometheus:/var/lib/prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/var/lib/prometheus
- --web.enable-admin-api
restart: unless-stopped
The command property takes a YAML list of values.
Each value must be indicated using a hyphen (- {value}).
The list values are double-hyphen flags (--web.enable-admin-api).
Alternatively, you can use the JSON variant which I've spread over multiple lines but can also be presented as a single line:
command: [
"--config.file=...",
"--storage.tsdb.path=...",
"--web.enable-admin-api"
]
Answer from DazWilkin on Stack OverflowPrometheus
prometheus.io › docs › operating › security
Security model | Prometheus
The --web.enable-admin-api flag controls access to the administrative HTTP API, which includes functionality such as wiping all the existing metric groups. This is disabled by default.
How to pass '--web.enable-admin-api' flag to prometheus container
I am using Prometheus-Operator release-0.17. In kube-prometheus/manifests/prometheus/prometheus-k8s.yaml , how do i pass the flag '--web.enable-admin-api' to prometheus container. More on github.com
--web.enable-admin-api doesn't exist.
Bug Report What did you do? I tried to use option --web.enable-admin-api What did you expect to see? I expect it to work What did you see instead? Under which circumstances? pushgateway: error: unk... More on github.com
Problem to enable api in Prometheus
In the first step I have to activate the web api function. When I type in the command "prometheus --web.enable-admin-api to the console" I get the attached output. More on github.com
Website --web.enable-admin-api confusion
Thanos, Prometheus and Golang version used: Thanos: v0.15 Prometheus: 2.21 In multiple places, including the sidecar docs, I have seen the following statement. The --web.enable-admin-api flag is en... More on github.com
Prometheus
prometheus.io › docs › prometheus › latest › querying › api
HTTP API | Prometheus
These are APIs that expose database functionalities for the advanced user. These APIs are not enabled unless the --web.enable-admin-api is set.
Red Hat
bugzilla.redhat.com › show_bug.cgi
2026844 – [ceph-dashboard] enable --web.enable-admin-api flag while starting the prometheus service to enable taking snapshots
Red Hat Bugzilla – Bug 2026844 · This site requires JavaScript to be enabled to function correctly, please enable it · Privacy Contact FAQ Legal
Robust Perception
robustperception.io › new-features-in-prometheus-2-0-0
New Features in Prometheus 2.0.0 – Robust Perception | Prometheus Monitoring Experts
For security reasons the admin and lifecycle APIs are now disabled by default. You can reenable them with the --web.enable-admin-api and --web.enable-lifecycle flags. Speaking of flags, Kingpin is now in use so all flags are prefixed with double rather than single hyphens.
JFrog
jfrog.com › blog home › don’t let prometheus steal your fire
Protecting Prometheus: Insecure configuration exposes secrets
May 1, 2026 - Other than the issue of sensitive data exposure due to developers’ and organizations’ non-secure deployments of Prometheus, it is important to mention an even bigger potential security issue – Prometheus provides an optional management API which can be enabled via the command line flags web.enable-admin-api and web.enable-lifecycle.
Ubuntu Manpages
manpages.ubuntu.com › manpages › focal › man1 › prometheus.1.html
Ubuntu Manpage: prometheus - The Prometheus monitoring server
--web.local-assets="/usr/share... --web.enable-lifecycle Enable shutdown and reload via HTTP request. --web.enable-admin-api Enable API endpoints for admin control actions....
DevOpsSchool
devopsschool.com › commands › tools › prometheus › prometheus
prometheus's Examples
If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically. ... Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url. ... Path to static asset directory, available at /user. ... Enable shutdown and reload via HTTP request. ... Enable API endpoints for admin control actions.
Google Groups
groups.google.com › g › prometheus-users › c › AVvsuRq5Gbo
delete metrics from prometheus 2.0
Looks like you forgot to enable admin API. Quote from manual (https://prometheus.io/docs/operating/security/): As of Prometheus 2.0, the --web.enable-admin-api flag controls access to the administrative HTTP API which includes functionality such as deleting time series.
Debian Manpages
manpages.debian.org › stretch-backports › prometheus › prometheus(1)
prometheus(1) — prometheus — Debian stretch-backports — Debian Manpages
August 5, 2018 - If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically. ... Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url. ... Path to static asset/templates directory. ... Path to user asset directory, available at /user. ... Enable shutdown and reload via HTTP request. ... Enable API endpoints for admin control actions.