[GH-ISSUE #552] Mounted Prometheus.yml file is not working #694

Closed
opened 2026-04-16 11:12:53 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @bbreunig on GitHub (Nov 25, 2025).
Original GitHub issue: https://github.com/Dokploy/templates/issues/552

Originally assigned to: @Siumauricio, @Copilot on GitHub.

Template Name

Prometheus

Relevant Logs of the Error

In Dokploy Volumes of the Prometheus template there is file prometheus.yml defined:

Image

However when looking into the configuration and also uncommenting parts of the file I noticed, that prometheus does not use the new configuration even after redeployments

mounted prometheus.yml

# Scrape configurations
scrape_configs:
  # Prometheus self-monitoring
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  # Example: Add your own targets here
  - job_name: 'node_exporter'
    static_configs:
      - targets: ['node-exporter:9100']

actual prometheus.yml

$ docker exec -it <prometheus-container> cat /etc/prometheus/prometheus.yml
# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]
       # The label name is added as a label `label_name=<label_value>` to any timeseries scraped from this config.
        labels:
          app: "prometheus"

Steps to Reproduce the Error

  1. Deploy the Prometheus Template
  2. Open Docker Terminal
  3. enter cat /etc/prometheus/prometheus.yml
  4. Copy or remember the file content
  5. Navigate to Advanced -> Volumes -> Edit Mount
  6. Compare file content in volumes with file content from before

Even more advanced:

  1. Uncomment any job in the mounted file
  2. Open Docker Terminal
  3. enter cat /etc/prometheus/prometheus.yml
  4. notice there are no changes to the contents of the file

Environment Information

Operating System: Ubuntu 24.04.3 LTS
Dokploy Version: v0.25.10
VPS Provider: Hetzner
Browser: Brave Browser

When does this error occur?

After successful deployment

Additional Context

  • I have not found any workaround

Will you send a PR to fix it?

Maybe, need help

Originally created by @bbreunig on GitHub (Nov 25, 2025). Original GitHub issue: https://github.com/Dokploy/templates/issues/552 Originally assigned to: @Siumauricio, @Copilot on GitHub. ### Template Name Prometheus ### Relevant Logs of the Error In Dokploy Volumes of the Prometheus template there is file `prometheus.yml` defined: <img width="1100" height="444" alt="Image" src="https://github.com/user-attachments/assets/a1a6260d-213f-4bd1-94f0-b6f3c4191a8d" /> However when looking into the configuration and also uncommenting parts of the file I noticed, that prometheus does not use the new configuration even after redeployments ### mounted prometheus.yml ```sh # Scrape configurations scrape_configs: # Prometheus self-monitoring - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] # Example: Add your own targets here - job_name: 'node_exporter' static_configs: - targets: ['node-exporter:9100'] ``` ### actual prometheus.yml ```sh $ docker exec -it <prometheus-container> cat /etc/prometheus/prometheus.yml # my global config global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: # - "first_rules.yml" # - "second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: "prometheus" # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ["localhost:9090"] # The label name is added as a label `label_name=<label_value>` to any timeseries scraped from this config. labels: app: "prometheus" ``` ### Steps to Reproduce the Error 1. Deploy the Prometheus Template 2. Open Docker Terminal 3. enter `cat /etc/prometheus/prometheus.yml` 4. Copy or remember the file content 5. Navigate to Advanced -> Volumes -> Edit Mount 6. Compare file content in volumes with file content from before ### Even more advanced: 1. Uncomment any job in the mounted file 2. Open Docker Terminal 3. enter `cat /etc/prometheus/prometheus.yml` 4. notice there are no changes to the contents of the file ### Environment Information ```bash Operating System: Ubuntu 24.04.3 LTS Dokploy Version: v0.25.10 VPS Provider: Hetzner Browser: Brave Browser ``` ### When does this error occur? After successful deployment ### Additional Context - I have not found any workaround ### Will you send a PR to fix it? Maybe, need help
GiteaMirror added the bug label 2026-04-16 11:12:53 -05:00
Author
Owner

@BrunoMont2003 commented on GitHub (Dec 18, 2025):

Hi! I've found the solution for this bug. It seems the volume mapping for the configuration file needs to be explicitly defined in the docker-compose.yml within the template to override the default internal file correctly.

You need to add the volume mount for the prometheus.yml file. Here is how the service configuration should look:

services:
  prometheus:
    image: prom/prometheus:latest
    restart: unless-stopped
    command:
      - "--config.file=/etc/prometheus/prometheus.yml"
      - "--storage.tsdb.path=/prometheus"
      - "--web.console.libraries=/usr/share/prometheus/console_libraries"
      - "--web.console.templates=/usr/share/prometheus/consoles"
      - "--web.enable-lifecycle"
    volumes:
      - ../files/etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro # Add this line
      - prometheus-data:/prometheus

volumes:
  prometheus-data: {}

By adding - ../files/etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro, Dokploy will correctly map the file edited in the "Volumes" section to the path Prometheus is looking for.

<!-- gh-comment-id:3671106614 --> @BrunoMont2003 commented on GitHub (Dec 18, 2025): Hi! I've found the solution for this bug. It seems the volume mapping for the configuration file needs to be explicitly defined in the docker-compose.yml within the template to override the default internal file correctly. You need to add the volume mount for the prometheus.yml file. Here is how the service configuration should look: ``` services: prometheus: image: prom/prometheus:latest restart: unless-stopped command: - "--config.file=/etc/prometheus/prometheus.yml" - "--storage.tsdb.path=/prometheus" - "--web.console.libraries=/usr/share/prometheus/console_libraries" - "--web.console.templates=/usr/share/prometheus/consoles" - "--web.enable-lifecycle" volumes: - ../files/etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro # Add this line - prometheus-data:/prometheus volumes: prometheus-data: {} ``` By adding - ../files/etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro, Dokploy will correctly map the file edited in the "Volumes" section to the path Prometheus is looking for.
Author
Owner

@bbreunig commented on GitHub (Dec 18, 2025):

There is a seperate issue with this solution:

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/etc/dokploy/compose/security-grafana-mxy5d3/files/etc/prometheus/prometheus.yml" to rootfs at "/etc/prometheus/prometheus.yml": mount src=/etc/dokploy/compose/security-grafana-mxy5d3/files/etc/prometheus/prometheus.yml, dst=/etc/prometheus/prometheus.yml, dstFd=/proc/thread-self/fd/37, flags=MS_BIND|MS_REC: not a directory: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Error: ❌ Docker command failed
Error occurred ❌, check the logs for details.

What I noticed is, that for some reason docker creates directories, where it should create files. I have not found a solution for that yet. The only workaround I have is to define all files I want to mount beforehand in a git repository and than connect this repository with dokploy and deploy from there. Only then, the file mount works.

<!-- gh-comment-id:3671144240 --> @bbreunig commented on GitHub (Dec 18, 2025): There is a seperate issue with this solution: ```bash Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/etc/dokploy/compose/security-grafana-mxy5d3/files/etc/prometheus/prometheus.yml" to rootfs at "/etc/prometheus/prometheus.yml": mount src=/etc/dokploy/compose/security-grafana-mxy5d3/files/etc/prometheus/prometheus.yml, dst=/etc/prometheus/prometheus.yml, dstFd=/proc/thread-self/fd/37, flags=MS_BIND|MS_REC: not a directory: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Error: ❌ Docker command failed Error occurred ❌, check the logs for details. ``` What I noticed is, that for some reason docker creates directories, where it should create files. I have not found a solution for that yet. The only workaround I have is to define all files I want to mount beforehand in a git repository and than connect this repository with dokploy and deploy from there. Only then, the file mount works.
Author
Owner

@BrunoMont2003 commented on GitHub (Dec 18, 2025):

That happened to me too! It's best to delete the service and create a new one, but with the correct configuration, as I mentioned before!

<!-- gh-comment-id:3672140381 --> @BrunoMont2003 commented on GitHub (Dec 18, 2025): That happened to me too! It's best to delete the service and create a new one, but with the correct configuration, as I mentioned before!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/templates#694