在构建容器时导入数据源和 grafana 仪表板
Importing datasource and grafana dashboard while building container
我正在尝试创建 docker 已预先配置数据源和仪表板的容器。
截至目前,我了解到从 v5.0 开始,grafana 引入了配置功能。
我创建了两个 yml 文件,第一个是数据源,第二个是仪表板。
但我无法理解 docker-compose 文件的哪一部分将调用这些 datasource.yml 和 dashboarad.yml 文件。我应该使用什么标签,所以 on.Below 是我的 docker-compose、数据源和仪表板文件的详细信息。
撰写文件中我唯一能理解的细节是 - ./grafana/provisioning/:/etc/grafana/provisioning/
将一些主机文件夹结构复制到容器(但不确定)。
docker-compose.yml
grafana:
image: grafana/grafana
links:
- influxdb
ports:
- '3000:3000'
volumes:
- 'grafana:/var/lib/grafana'
- ./grafana/provisioning/:/etc/grafana/provisioning/
Dashboard.yml
apiVersion: 1
providers:
- name: 'Docker Dashboard'
orgId: 1
folder: ''
type: file
disableDeletion: false
updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards
options:
path: <path-where-I-have-placed-jsonfile>
Datasource.yml
datasources:
- access: 'proxy' # make grafana perform the requests
editable: true # whether it should be editable
is_default: true # whether this should be the default DS
name: 'influx' # name of the datasource
org_id: 1 # id of the organization to tie this datasource to
type: 'influxdb' # type of the data source
url: 'http://<ip-address>:8086' # url of the prom instance
database: 'influx'
version: 1 # well, versioning
volumes
指令将 运行 仅在 runtime
而不是 build
如果你想让它在 [=14] 中工作,你需要使用 COPY
=]阶段
Docker 文件:
FROM grafana/grafana
COPY ./grafana/provisioning /etc/grafana/provisioning
./grafana/provisioning
应该是相对于 Dockerfile
撰写:
grafana:
build: .
.
.
我正在尝试创建 docker 已预先配置数据源和仪表板的容器。
截至目前,我了解到从 v5.0 开始,grafana 引入了配置功能。
我创建了两个 yml 文件,第一个是数据源,第二个是仪表板。
但我无法理解 docker-compose 文件的哪一部分将调用这些 datasource.yml 和 dashboarad.yml 文件。我应该使用什么标签,所以 on.Below 是我的 docker-compose、数据源和仪表板文件的详细信息。
撰写文件中我唯一能理解的细节是 - ./grafana/provisioning/:/etc/grafana/provisioning/
将一些主机文件夹结构复制到容器(但不确定)。
docker-compose.yml
grafana:
image: grafana/grafana
links:
- influxdb
ports:
- '3000:3000'
volumes:
- 'grafana:/var/lib/grafana'
- ./grafana/provisioning/:/etc/grafana/provisioning/
Dashboard.yml
apiVersion: 1
providers:
- name: 'Docker Dashboard'
orgId: 1
folder: ''
type: file
disableDeletion: false
updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards
options:
path: <path-where-I-have-placed-jsonfile>
Datasource.yml
datasources:
- access: 'proxy' # make grafana perform the requests
editable: true # whether it should be editable
is_default: true # whether this should be the default DS
name: 'influx' # name of the datasource
org_id: 1 # id of the organization to tie this datasource to
type: 'influxdb' # type of the data source
url: 'http://<ip-address>:8086' # url of the prom instance
database: 'influx'
version: 1 # well, versioning
volumes
指令将 运行 仅在 runtime
而不是 build
如果你想让它在 [=14] 中工作,你需要使用 COPY
=]阶段
Docker 文件:
FROM grafana/grafana
COPY ./grafana/provisioning /etc/grafana/provisioning
./grafana/provisioning
应该是相对于 Dockerfile
撰写:
grafana:
build: .
.
.