Thanks for opening this post.
There are some certain steps to provision a dashboard into the Grafana while using Docker (docker-compose v3).
I also played around with it today and it seems to be working for me so I will try to explain it step by step and it should work for you (maybe you need v.small modification in adjusting your path etc.)
While using the Docker image, there are some default config paths as defined here. For us the important ones are;
Create a directory let’s say my-grafana-dashboard and inside it, define the following files and folders (here is my
tree command output);
[root@docker my-grafana-dashboard]# tree
│ ├── default.yml
│ └── my-dashboard.json
For the file
my-dashboard.json put the JSON data of the dashboard. For e.g., I put a telegraf dashboard data after downloading the JSON from this link (you can put any other or your own working one).
As per documentation we need to create a file inside the provisioning directory as
default.yml and there put the most minimal required data. In my case I put as per documentation i.e.;
# <string> an unique provider name. Required
- name: 'TEST TELEGRAF Provising test'
# <int> Org id. Default to 1
# <string> name of the dashboard folder.
# <string> folder UID. will be automatically generated if not specified
# <string> provider type. Default to 'file'
# <int> how often Grafana will scan for changed dashboards
# <bool> allow updating provisioned dashboards from the UI
# allowUiUpdates: false #you can set this value as per your need
# <string, required> path to dashboard files on disk. Required when using the 'file' type
# though as per the documentation it says that the path for Linux is /var/lib/grafana
# but in docker (see step 1) it is like this.
You can find the complete details here but for us, this minimum config is fine to make a test.
Now define the following code in the
# if you are running as root then set it to 0 else find the right id with the id command
# defining our main config parameters for provisioning if we have datasource
# commented it out as for now we do not need it
# - ./provisioning/datasources:/etc/grafana/provisioning/datasources/
# defining our main config parameters for provisioning for dashboards
Finally, run the command
[root@docker my-grafana-dashboard]# docker-compose up -d
Wait for 10 seconds and then you should see the dashboard
If you run into any problems, then check the logs via command:
[root@docker my-grafana-dashboard]# docker-compose logs grafana