docker化安裝grafana

繼續進行docker改造。linux

1. 找鏡像、拉取鏡像sql

[root@devlop ~]# docker search grafana
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED docker.io docker.io
/grafana/grafana The official Grafana docker container 960 docker.io docker.io/kamon/grafana_graphite All in one image running StatsD, Graphite ... 150 docker.io docker.io/monitoringartist/grafana-xxl Dockerized Grafana 5.x/4.x/3.x with all pr... 74 [OK] docker.io docker.io/samuelebistoletti/docker-statsd-influxdb-grafana Docker Image with Telegraf (StatsD), Influ... 62 [OK] docker.io docker.io/tutum/grafana Grafana dashboard for InfluxDB. Please set... 57 [OK] docker.io docker.io/fg2it/grafana-armhf Unofficial Grafana docker container for armhf 36 docker.io docker.io/philhawthorne/docker-influxdb-grafana A docker container to run InfluxDB and Gra... 9 [OK] docker.io docker.io/appcelerator/grafana Grafana image based on Alpine linux 5 [OK] docker.io docker.io/istio/grafana 4 docker.io docker.io/luzifer/grafana Automated build from Grafana Debian package 3 [OK] docker.io docker.io/bitnami/grafana Bitnami Docker Image for Grafana 2 [OK]

2. 啓動鏡像docker

docker run -d -p 3000:3000 --name=grafana -v /data/grafana:/var/lib/grafana grafana/grafana

3. 查看日誌app

[root@devlop ~]# docker logs -f grafana
GF_PATHS_DATA='/var/lib/grafana' is not writable.
You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later
mkdir: cannot create directory '/var/lib/grafana/plugins': Permission denied

發現報錯,對'/var/lib/grafana/plugins'沒有權限建立目錄,那麼就賦予權限:ide

chmod 777 /data/grafana

重啓grafanaui

docker restart grafana

再次查看下日誌,發現成功了spa

t=2018-12-10T07:45:50+0000 lvl=info msg="Starting Grafana" logger=server version=5.4.0 commit=69c5191 branch=HEAD compiled=2018-12-03T10:17:42+0000
t=2018-12-10T07:45:50+0000 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2018-12-10T07:45:50+0000 lvl=info msg="Config loaded from" logger=settings file=/etc/grafana/grafana.ini
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.data=/var/lib/grafana"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.logs=/var/log/grafana"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.provisioning=/etc/grafana/provisioning"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.log.mode=console"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_DATA=/var/lib/grafana"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_LOGS=/var/log/grafana"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_PLUGINS=/var/lib/grafana/plugins"
t=2018-12-10T07:45:50+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_PROVISIONING=/etc/grafana/provisioning"
t=2018-12-10T07:45:50+0000 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2018-12-10T07:45:50+0000 lvl=info msg="Path Data" logger=settings path=/var/lib/grafana
t=2018-12-10T07:45:50+0000 lvl=info msg="Path Logs" logger=settings path=/var/log/grafana
t=2018-12-10T07:45:50+0000 lvl=info msg="Path Plugins" logger=settings path=/var/lib/grafana/plugins
t=2018-12-10T07:45:50+0000 lvl=info msg="Path Provisioning" logger=settings path=/etc/grafana/provisioning
t=2018-12-10T07:45:50+0000 lvl=info msg="App mode production" logger=settings
t=2018-12-10T07:45:50+0000 lvl=info msg="Initializing HTTPServer" logger=server
t=2018-12-10T07:45:50+0000 lvl=info msg="Initializing SqlStore" logger=server
t=2018-12-10T07:45:50+0000 lvl=info msg="Connecting to DB" logger=sqlstore dbtype=sqlite3
View Code

4. 檢查rest

  訪問http://172.28.64.10:3000/,成功的話會出現如下頁面日誌

相關文章
相關標籤/搜索