1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Vagrant + Docker + Prometheus + Grafana 設定ファイルのマウント失敗について(open /etc/prometheus/prometheus.yml: permission denied")

Last updated at Posted at 2019-03-06

環境

  • Vagrant 2.2.3
  • CentOS 7
  • Docker 1.13.1
  • Prometheus 2.7.2
  • Grafana 6.0.0

事象

docker-compose.yml記載のvolumes
prometheus.ymlのマウント失敗

docker-compose.yml

version: '3'
services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - 9090:9090
  grafana:
    image: grafana/grafana
    container_name: grafana
    ports:
      - 3000:3000
    env_file:
      - ./prometheus/grafana.env
  node-exporter:
    image: quay.io/prometheus/node-exporter
    container_name: node-exporter
    ports:
      - 9100:9100
    volumes:
      - /proc:/host/proc
      - /sys:/host/sys
      - /:/rootfs
      

エラーメッセージ

err="error loading config from \"/etc/prometheus/prometheus.yml\": couldn't load configuration (--config.file=\"/etc/prometheus/prometheus.yml\"): open /etc/prometheus/prometheus.yml: permission denied"

原因

SELinuxのアクセス制限のため

解決方法

一時的手段
下記コマンドを叩く(enforcing→permissiveに変更)

sudo setenforce 0 

非推奨

以下はSElinuxによりセキュアになっている、アクセス制限などがザルになるのでオススメしない。
恒久的解決
SElinuxの設定ファイルの書き換え(enforcing→permissiveに変更)

vi /etc/selinux/config
SELINUX=permissive

SELINUX=? ?の箇所のモードについては下記参照
SELINUX の有効化および無効化(RedHat)

確認

サーバ再起動後、下記コマンドを叩いて現在のモードを確認

getenforce
Permissive と出力されれば変更されている

Link

「SELinuxのせいで動かない」撲滅ガイド

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?