4
8

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 5 years have passed since last update.

Dockerで、さくっとGrafanaを起動するスクリプト

Last updated at Posted at 2019-07-11

以下の内容を、start-grafana.shファイルで保存して実行。

IMAGE_NAME=grafana/grafana
CONTAINER_NAME=grafana

for container_id in $( docker container ls --all --quiet --filter name=$CONTAINER_NAME); do
  docker container rm --force ${container_id}
done

docker container run \
  --detach \
  --env "GF_SERVER_ROOT_URL=http://localhost:3000" \
  --env "GF_INSTALL_PLUGINS=grafana-polystat-panel,bessler-pictureit-panel" \
  --mount type=volume,source=grafana_lib,target=/var/lib/grafana \
  --name=$CONTAINER_NAME \
  --publish 3000:3000 \
  $IMAGE_NAME 

echo "http://localhost:3000 login to grafana with admin/admin"

プラグインを追加したい場合は、下記の部分にプラグイン名を追加して、再実行。

  --env "GF_INSTALL_PLUGINS=grafana-polystat-panel,bessler-pictureit-panel" \

追記

InfluxDB + Grafana を起動するサンプルも作りました。
https://github.com/satotka/docker-grafana

  • docker-composeを利用。コンテナ起動オプションをYAMLファイルで定義。
  • Makefileを利用。make upとコマンド打つだけで起動。
  • Grafanaのプロビジョニングを利用し、データソース設定も事前定義可能。
4
8
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
4
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?