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

Prometheus configuration in tutorial leads to directory mount error #20

Open
BBITWestin opened this issue Jan 21, 2025 · 1 comment
Open

Comments

@BBITWestin
Copy link

Issue Description

Following the tutorial instructions for adding Prometheus results in an error where Prometheus attempts to read its configuration file but encounters a directory instead.

Current Behavior

When following the tutorial steps exactly as written, Prometheus fails to start with the following error:

level=ERROR source=main.go:593 msg="Error loading config (--config.file=/etc/prometheus/prometheus.yml)" file=/etc/prometheus/prometheus.yml err="read /etc/prometheus/prometheus.yml: is a directory"

The error keeps repeating and Prometheus exits with code 2.

Current Tutorial Configuration

docker-compose.yml section:

  prometheus:
    image: prom/prometheus
    container_name: prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    ports:
      - 9090:9090
    restart: unless-stopped
    volumes:
      - ./prometheus:/etc/prometheus

Environment

@alexsh134
Copy link

@BBITWestin, You are right! Same issue here.
There is some issue mounting ./prometheus. volume into /etc/prometheus or locating prometheus.yml in local file system.

The workaround that worked for me:

  1. In docker-compose.yml => comment out the command causing the issue
    command:
    - '--config.file=/etc/prometheus/prometheus.yml'
  2. Start the container
  3. In Docker Desktop locate and open prometheus container
  4. Navigate to Files tab
  5. Navigate to /etc
  6. Right click on /etc and import /prometheus folder from your file system
  7. Stop container
  8. Uncomment the command in docker-compose.yml
  9. Run "docker compose up"

Hopefully the container will start properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants