dockergoogle-cloud-platformgrafana

How to mount a GCP Cloud Storage volume in GCP Cloud Run service?


I'm trying to mount a volume type GCP Cloud Storage Bucket in GCP Cloud Run container that runs an official Docker grafana/grafana:10.3.12 image. The volume is configured with mounted path /etc/grafana but when deploy new revision the logs show the following error.

"mkdir: can't create directory '/etc/grafana/provisioning/plugins': No such file or directory"

My Dockerfile and grafana.ini config is the following.

grafana.ini:

GF_PATHS_CONFIG="/etc/grafana/grafana.ini"
GF_PATHS_DATA="/etc/grafana"
GF_PATHS_LOGS="/etc/grafana/logs"
GF_PATHS_PLUGINS="/etc/grafana/provisioning/plugins"
GF_PATHS_PROVISIONING="/etc/grafana/provisioning"

Dockerfile:

FROM grafana/grafana:10.3.12
USER root
COPY --chown=472:0 ./project/grafana.ini /etc/grafana/grafana.ini
COPY --chown=472:0 ./project/provisioning /etc/grafana/provisioning
RUN chown 472 -R /etc/grafana
USER 472
...

The service works well and I can access to Grafana and configure datasources and dashboards but the information isn't persisted in my GCS bucket.


Solution

  • Solved modifying the Grafana environment vars

    GF_PATHS_CONFIG="/etc/grafana/grafana.ini"
    GF_PATHS_DATA="/var/lib/grafana"
    GF_PATHS_LOGS="/var/lib/grafana/logs"
    GF_PATHS_PLUGINS="/var/lib/grafana/plugins"
    GF_PATHS_PROVISIONING="/var/lib/grafana/provisioning"
    

    And the Cloud Run volume should be directly Bucket root not subfolder within.