Your problem has several suspects, but your question has not provided enough information to eliminate any of them. Here are some ideas:
Why do you leave this in when you're trying to troubleshoot
2. As suggested by both of the other answers: You should put some code in your docker container to test for the presence of the mount before attempting a write.
I'd suggest you take a look at
findmnt to perform this test. Another tutorial reference on
findmnt is found at HTG.
3. Awareness of the under-voltage condition
An interrupt would be the best way to get useful information on under-voltage events. But AFAIK, there is no way for us mortals to get an interrupt from the RPi (if it even exists) with stock hardware & closed-source firmware. There have been a few discussion threads at the sawmill on that - for example, but I'm not aware of anything useful. Without an interrupt, we are stuck with polling - as suggested in @goldilocks' answer - and its attendant lower time resolution.
But don't get discouraged by inadequate event time resolution. If you're getting regular reports of low voltage from the
vcgencmd get_throttled reports, this is something you should address. In other words:
- Get a better power supply
- Use the shortest power leads possible
- Use the heaviest AWG wiring available in your power leads
If you're interested in the "mechanics" of the Low-Voltage warning, there are some details in this answer that may be of interest. There's enough information here to enable you to do a real-time capture of a low-voltage event using a simple voltage comparator (e.g. to generate an interrupt) - or with an oscilloscope. But again, I don't recommend that if
vcgencmd get_throttled has informed you that these low voltage events are happening as you've already got the evidence you need to pursue a remedy to your power supply issues.