Best Practice for Docker Compose Volume usage

Hey folks,

I started a simple IoT Project and figured out how to setup a compose File for Influxdb2 on a raspberryPi5.

So my question is more a best practice thing. How to manage Data with Docker Volumes instead of “bind mounting”.

In my case I use Node-red, MQTT and Grafana. So simple and pretty standard for Sensor Data to be stored and then visualized.

My Question is: How useful is it to use docker Volume or bind mounting? Is there a best practice Pro/Contra for both ways? I managed to store the data via in a docker Volume, and the config file in a bind mounted directory. But where is the need? What are the benefit, if I use the minimalistic setup just to get use to InfluxDB2 and IoT stuff?

I just want to hear some best practice use cases and some thoughts that can help me to decide which way is best for my “System”

Thank you all for your answers! Greetings from Germany

1 Like

Hello @ZarPetrovich,
Here’s a resource you might find helpful:

I don’t have an answer, but I’m interested in this topic, as I’ve been revising InfluxDB documentation for Docker and experimenting with using volumes. I’ll also ask the team about recommendations or cautions for using Bind vs. Volume.

I suspect it’s this, if by “minimalistic” you mean “bind mounted”. It’s less cognitive load and more familiar when getting started.

@Anaisdg, was your reply intended for a different question?

Hey Jason!

So. Yes I think, theres a slightly gap between the question and the suggested topics from Anaisdg.

My minimalistic Setting is without any SSL/Password/other security things. Also, I don´t use the config file that much. But for the future it might be helpful, to have this files bind mounted. But my question is more about a basic question about, when to use Bind mounted and when Docker Volumes, for reasons eg. Datasecurity, Handling, Speed or more open things to think about in this decision.

Yeah. So I´m a student just startin with IoT programming, so that´s why I´m asking this theoretical basic question.