External Media + Multiple containers (Raspberry Pi 3B+)

I’ve read the article Communicate outside the container: Storage. I was wondering if a device could be mounted in a multiple container setup as a volume that could be shared by multiple containers. I have data on the storage which more than one container needs access to.

If that’s not possible, are there any potential workarounds? Or, am I misunderstanding what can be done in terms of mounting an external device?

Hey @jsadoski,

If you want to access external devices from multiple containers, you could follow the information from this page:

Exactly what kind of device are you trying to mount?

Thank you,

Sorry for the very late reply. I had to set this project aside for a while, but recently I’ve been able to pick it back up.

I’m trying to mount a 3 TB USB drive on a Raspberry Pi. I was able to accomplish this based on the article you provided. I gave the containers the appropriate privileges and I was able to mount via my entrypoint script.

The process is somewhat laborious and prone to create a lot of issues, however. For example, when trying to run a container such as linuxserver/mariadb, I need to hook up persistent storage for the /config directory before any execution of mariadb. I can’t mount the drive in the Dockerfile, as it would fail on the build server. Because /config is already busy, I can’t mount or link anything there. I can get my mount script to run before other execution, but this is not as easy to do for each container as specifying a bind in the docker-compose.yml.

Anyways, the information was very helpful. Thank you!

EDIT: After some thought, it would be really viable to use named volumes if I could choose where those volumes were stored. I’m creating a system to backup large uncompressed video files, so the SD card will not be sufficient storage space. Does balenaOS permit me to change the place that volumes are stored?