Not able to see mounted drive in volume

I have two containers. One contains samba file server. Second manage mounting of SD card. They share together one volume, which is used to share date from SD card to samba server. Problem is that after mounting SD card into shared volume SD card container see mounted SD card, but Samba container sees nothing.

I tried to mount SD card to a different directory and then create a symlink, but it didn’t help. Everything works, when I copy data from SD card into shared volume.

Samba container: alpine linux
SD card container: debian

Hi, mounting the SD card into the shared volume won’t work. I believe, as the access to the drive is not shared between the services. This is actually a feature that we are working on adding (access to a mounted drive in multiple services), but it’s still work in progress, and we don’t have an exact timeline yet. Thus at the moment probably the best is if the samba file server’s service is the one that mounts the external storage.

Does this help somewhat?

Do you have an inexact timeline? Are we talking weeks, months, years? I am eager to try out the OS on a pi 4 since you did the awesome work of fully supporting the device but without being able to expand the storage using USB and share it between containers it’s a tangle of confusion for how to make it work for me.

We are actively discussing the technical requirements and the user experience, and it’s been going on a bit, because it’s not a simple feature within balenaOS.

Can you elaborate on this, why? What sort of tangle are you running into?

Sure.

I think the basic use case is that I don’t actually have the skill/time to build docker containers and am using prebuilt ones. I know how to do this on an ubuntu server or raspbian. I mount the drive and then use the docker compose file to expose the files to the containers.

In this case, I need various containers to have access to the same usb drive full of video files. Some containers download files, others modify them, others serve them.

I had all this set up on raspbian but the network stack there ran me in circles trying to get it connected to a wpa2 enterprise network. It doesn’t work out of the box and there’s no actual documentation of the network stack I can find.

I like the dashboard access that balena offers.

I did spend the day trying to figure out how the balena os does the root overlay so I could just add the one usb drive to the host os fstab and call it a day. I failed at that lol.

Ok, so it looks, that I will need to get into single container. In SD card container, there is python script, that I need to get running. Is it possible to start samba before that python script and get two services running in one container? I know, that there is problem with controlling services in background of OS.

Hi,
Yeah, our internal discussions regarding sharing external drive between containers are still ongoing. We’ll post the news here once we have some decisions.

As for dealing with multiple processes in a single container, there are multiple options you could go with.
We have some info and recommendations on how to use systemd in your container for this purpose.

This would allow you to configure multiple services to run in the container.
Another similar option could be using supervisor (https://supervisord.org) to control multiple services in your container. I think this resource may be useful to get started:
https://advancedweb.hu/2018/07/03/supervisor_docker/

Hope this helps.

1 Like

Would it be a good idea to just run docker in a docker container to mount the drive and set the environment?

It’s not really a pattern we would explicitly recommend, but there is a good chance it will work, though of course YMMV :slight_smile:
Is it not possible to have the container with samba also handle the mounting?

I don’t know. Is it possible to mount smb shares using docker-compose and a prebuilt docker container repository? Or is it possible to run arbitrary code using docker-compose at the boot of a container without modifying the container itself?

I read through the docker-compose file options page and didn’t find any option that made sense to do either of these.

You can use the command option of the docker-compose file. Docs here: https://docs.docker.com/compose/compose-file/compose-file-v2/#command

I’m not too sure about this, definitely something that would require testing.

Thanks for working with me on this. It says the command overrides the default command. Does that mean I should copy out the default command and modify it to add what I want?

It’s basically just the command that runs when the container starts. Likely you’ll need to execute whatever it is supposed to be executing on top of your own code. You can find out the default command by inspecting the image locally with docker pull <image>; docker inspect <image> | grep command

1 Like