Complete the code to start a Prometheus container with the official image.
docker run -d --name prometheus [1] prom/prometheusThe Prometheus server listens on port 9090 by default, so we map port 9090 from the container to the host.
Complete the command to mount a local Prometheus configuration file into the container.
docker run -d --name prometheus -p 9090:9090 -v [1]:/etc/prometheus/prometheus.yml prom/prometheus
You need to mount your local Prometheus config file (e.g., /home/user/prometheus.yml) to the container's expected config path.
Fix the error in the Prometheus scrape config to monitor Docker metrics.
scrape_configs: - job_name: 'docker' static_configs: - targets: ['[1]']
Docker metrics are exposed on the Docker daemon API port 2375 (if enabled). Prometheus scrapes this target.
Fill both blanks to configure Prometheus to scrape metrics from Docker and node exporter.
scrape_configs: - job_name: 'docker' static_configs: - targets: ['[1]'] - job_name: 'node' static_configs: - targets: ['[2]']
Docker metrics come from port 2375, node exporter metrics come from port 9100.
Fill all three blanks to create a Docker Compose service for Prometheus with port mapping and config volume.
services:
prometheus:
image: prom/prometheus
ports:
- '[1]:9090'
volumes:
- '[2]:/etc/prometheus/prometheus.yml'
command:
- '--config.file=[3]'Map host port 9090 to container 9090, mount local config file, and tell Prometheus where the config file is inside the container.