docker - 在构建容器时导入数据源和 grafana 仪表板
问题描述
我正在尝试使用已经预配置的数据源和仪表板创建 docker 容器。到目前为止,我可以理解,从 v5.0 开始,grafana 已经引入了配置功能。我创建了两个 yml 文件,首先是数据源,其次是仪表板。但我不明白 docker-compose 文件的哪一部分会调用这些 datasource.yml 和 dashboarad.yml 文件。我应该使用什么标签等等。下面是我的 docker-compose、数据源和仪表板文件详细信息。我可以理解的撰写文件中的唯一细节是 -./grafana/provisioning/:/etc/grafana/provisioning/
将一些主机文件夹结构复制到容器(但不确定)。
码头工人-compose.yml
grafana:
image: grafana/grafana
links:
- influxdb
ports:
- '3000:3000'
volumes:
- 'grafana:/var/lib/grafana'
- ./grafana/provisioning/:/etc/grafana/provisioning/
仪表板.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>
数据源.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
使用的情况下运行COPY
build
Dockerfile:
FROM grafana/grafana
COPY ./grafana/provisioning /etc/grafana/provisioning
./grafana/provisioning
应该相对于Dockerfile
撰写:
grafana:
build: .
.
.
推荐阅读
- ios - 对 openCropper 的 react-native-image-crop-picker 调用仅导致 ios 崩溃
- sql - SQL - 仅在它们匹配的地方用另一个表列替换列值,否则保留原始值?
- spring-boot - Spring Boot 启动器中的 Camunda 内存泄漏
- debugging - 在 Sapper 服务器代码中设置断点——可行吗?
- python - 创建代码以执行数百次谷歌搜索并提取发布日期
- python - 当多个容器在 AWS Batch 上并行运行时,带有 Selenium 和 Chrome webdriver 的 Docker 容器崩溃
- python - 从 csv 文件中的字符串中提取特定信息
- react-native - 使用 Jest/redux-mock-store 模拟 Redux Store 的问题
- spring-boot - 使用没有服务名称的 Spring Cloud Gatway + Eureka 自定义动态路由
- parsing - 如何让字符串解析器终止