Balena shared drive over the network

Hello,
I have a multicontainer running on a raspberry pi, and a shared volume between services.
i want to be able to share this volume across the network, meaning, to be able to access to the resin-data volume from other PC(linux or windows) or any other mobile app. (with the device name or ip, for example \device-name\resin-data)
Is that possible?

this is how my volume is defined. (its working great between services)
volumes:
resin-data:
process:
container_name: process
build:
context: ./process
volumes:
- ‘resin-data:/data’
server:
container_name: server
build:
context: ./server
volumes:
- ‘resin-data:/data’

Hi,

The way to do this would be to add another service to your application, that exposes the volume as a samba share, nfs share, or a a simple ssh server (and use sshfs).

thank you for the reply.
this service should expose any port to share ? (lets say if i use samba)

Hi,

If you know which ports you need to be exposed for each service, you can just specify them in the ports section of the docker-compose file. From the top of my head you need 139 and 445 for samba, so the ports section for that service should look like this:

ports:
    - "139:139"
    - "445:445"

This would expose the ports 139 and 445 of the container on the host.

thank you, i will try this and hopefully will post the solution so other people can use it. (or will ask more questions :wink: )

Cool. If you have anymore question please ask them. :slight_smile:

hi, so i’ve added two things, a container as a file share, i’m sharing what i added to the docker-compose.yml and the dockerfile of the container.
everything works great now, and i can access the volume from other computer in the network.

base-image for python on any machine using a template variable,

see more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/

FROM balenalib/%%RESIN_MACHINE_NAME%%-python:3-stretch-run
RUN apt clean
RUN apt update
RUN apt install samba
RUN apt install samba-common-bin
COPY smb.conf /etc/samba/smb.conf
COPY start.sh start.sh
ENV UDEV=1
ENTRYPOINT ["/bin/bash", “start.sh”]

docker-compose.yml addon:
filesshare:

container_name: filesshare

build:

    context: ./filesshare

ports:

    - "137:137/udp" # required to advertise shares (NMBD)

    - "138:138/udp" # required to advertise shares (NMBD)

    - "139:139/tcp" # default smb port

    - "445:445/tcp" # default smb port

volumes:

  - 'resin-data:/data'