gpt4 book ai didi

docker - 在构建容器时导入数据源和grafana仪表板

转载 作者:行者123 更新时间:2023-12-02 19:23:29 24 4
gpt4 key购买 nike

我正在尝试使用已预先配置的数据源和仪表板创建Docker容器。
到目前为止,我可以理解,从v5.0开始,grafana引入了预配功能。
我创建了两个yml文件,第一个是数据源,第二个是仪表板。
但是我不明白docker-compose文件的哪一部分将调用这些datasource.yml和dashboarad.yml文件。我应该使用什么标签等等,下面是我的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>

数据源
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中运行,如果要在COPY阶段运行,则需要使用build
Dockerfile:

FROM grafana/grafana
COPY ./grafana/provisioning /etc/grafana/provisioning
./grafana/provisioning应该相对于 Dockerfile
撰写:
grafana:
build: .
.
.

关于docker - 在构建容器时导入数据源和grafana仪表板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58166125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com