It looks like there are some problems with the volume configuration in your Grafana container:
First, I think this was simply a typo in your question:
- grafana_ini:/etc/grafana/grafana.inianticipated location in container
I suspect that you were actually intending this:
- grafana_ini:/etc/grafana/grafana.ini
Which doesn't make any sense: grafana.ini is a file, but a volume is
a directory. Docker won't allow you to mount a directory on top of a
file, hence the error:
ERROR: .../etc/grafana/grafana.ini is not directory
You have the same problem with the grafana_data volume, which you're
attempting to mount on top of datasource.yml:
- grafana_data:/etc/grafana/provisioning/datasources/datasource.yml
I think you may be approaching this configuration in the wrong way; you may want to read through these documents:
- https://grafana.com/docs/grafana/latest/installation/docker/
- https://grafana.com/docs/grafana/latest/administration/configure-docker/
- https://grafana.com/docs/grafana/latest/administration/provisioning/
It is possible to configure Grafana (and Prometheus!) using only bind mounts and environment variables (this includes installing plugin, data sources, and dashboards), so you don't need to build your own custom images.
Unrelated to this particular problem, there are some other things in
your docker-compose.yml that are worth changing. You should no
longer be using the links directive...
links:
- prometheus
...because Docker maintains DNS for you automatically; your containers can refer to each other by name with no additional configuration.
Answer from larsks on Stack OverflowGrafana on Docker - Stack Overflow
How can I store data with Docker Compose containers? - Stack Overflow
Running Grafana as Docker, but doesn't remember my changes if I restart the container
What volumes should I mount when using Docker? - Grafana - Grafana Labs Community Forums
It looks like there are some problems with the volume configuration in your Grafana container:
First, I think this was simply a typo in your question:
- grafana_ini:/etc/grafana/grafana.inianticipated location in container
I suspect that you were actually intending this:
- grafana_ini:/etc/grafana/grafana.ini
Which doesn't make any sense: grafana.ini is a file, but a volume is
a directory. Docker won't allow you to mount a directory on top of a
file, hence the error:
ERROR: .../etc/grafana/grafana.ini is not directory
You have the same problem with the grafana_data volume, which you're
attempting to mount on top of datasource.yml:
- grafana_data:/etc/grafana/provisioning/datasources/datasource.yml
I think you may be approaching this configuration in the wrong way; you may want to read through these documents:
- https://grafana.com/docs/grafana/latest/installation/docker/
- https://grafana.com/docs/grafana/latest/administration/configure-docker/
- https://grafana.com/docs/grafana/latest/administration/provisioning/
It is possible to configure Grafana (and Prometheus!) using only bind mounts and environment variables (this includes installing plugin, data sources, and dashboards), so you don't need to build your own custom images.
Unrelated to this particular problem, there are some other things in
your docker-compose.yml that are worth changing. You should no
longer be using the links directive...
links:
- prometheus
...because Docker maintains DNS for you automatically; your containers can refer to each other by name with no additional configuration.
Another problem that can cause a similar error, is when mixing up the file name extensions. Be mindful to not refer to them as .yaml in the docker-compose.yml file, when you've actually used .yml. Or vice versa.
For example, you have the following file:
grafana_datasources.yml
Then don't do (.yaml):
./evidently_service/config/grafana_datasources.yaml:/etc/grafana/provisioning/datasources/grafana_datasources.yaml
Do this instead (.yml):
./evidently_service/config/grafana_datasources.yml:/etc/grafana/provisioning/datasources/grafana_datasources.yml
Hello,
I'm running Grafana as a Docker using:
https://devconnected.com/how-to-install-influxdb-telegraf-and-grafana-on-docker/
I'm new to Docker, but I go into Grafana and setup a datasource and simple dashboard and all is ok, but if I restart the VM the container runs on or restart the docker contain instance it's as if I have just set it up as all changes are gone.
What do I need to do to save my changes?
Thanks
I feel like I may be missing something simple but for the life of me can't find out why. I haven't been able to successfully Google my issue so hopefully someone here has an idea.
I am trying to move all my docker containers to docker-compose, my reasonaning is it seems easier to recreate them when I upgrade the images. Having all the info in the .yml file of docker-compose seems cleaner than keeping my docker run commands in a Google Doc.
I am using a persistent volume to store the data, which I think is where my issue is coming from.
Currently, to start Grafana I run the following:
docker run -d -p 3000:3000 --name=grafana --restart=always -v grafana-storage:/var/lib/grafana grafana/grafana
I have translated that into my docker-compose.yml file as:
grafana:
container_name: grafana
image: grafana/grafana
ports:
- "3000:3000"
volumes:
- grafana-storage:/var/lib/grafana
restart: always
network_mode: hostI have some other services so I haven't copied the whole file but the volume: section is popoulated fine. The Grafana service comes up fine, it gets to the login screen and I can't use my regular login/password. So I am thinking it's not accessing the persistent information in the container.
I have removed the container and recreated it with docker-compose up. I have then also been able to go back to a working Grafana instance by running my old docker container again.
Am I missing a step? Thank you so much for reading this far.
**I just tried migrating Portainer and I have the same issue, no persistent storage, it's asking me to create a new user, no login screen.
*** I've also tried using the external: true command to no effect
volumes:
home-assistant-volume:
grafana-storage:
external: true
portainer_data:
external: trueI have also followed the suggestions here: https://stackoverflow.com/questions/60148581/re-using-existing-volume-with-docker-compose