UNASPRO Shared Drives and Docker volumes mount

How to Mount Unaspro NFS Shares as Docker Volumes If you're using a Unifi Unaspro NFS server and want to leverage it for persistent storage in your Docker containers, this guide will walk you through the process. This approach allows your containers to access shared storage that persists beyond container lifecycles. Prerequisites A Linux server with Docker installed A Unaspro NFS server on your network Basic understanding of Docker and NFS Step 1: Verify Your NFS Exports Before attempting to mount anything, it's crucial to verify what paths your Unaspro server is actually exporting. The Unifi dashboard might show one path, but the actual exported path could be different. Run this command to see the available NFS shares: showmount -e YOUR_UNASPRO_IP For example: showmount -e 10.1.1.1 This might return something like: Export list for 10.1.1.1: /volume1/.srv/.unifi-drive/[Shared Drive Name]/.data [YOUR_SERVER_IP] Important: Note the exact path shown here. This is the actual path you'll need to use, not what might be shown in the Unifi dashboard. Step 2: Create a docker-compose.yml File Create a docker-compose.yml file with the following content: version: '3' services: your-service: image: ubuntu # or any image you prefer command: tail -f /dev/null # Keeps the container running volumes: - nfs-data:/mount/point # Add other container configurations as needed volumes: nfs-data: driver: local driver_opts: type: nfs o: "addr=YOUR_UNASPRO_IP,rw,nfsvers=3,nolock" device: ":/EXACT_PATH_FROM_SHOWMOUNT" Replace: YOUR_UNASPRO_IP with your Unaspro server IP (e.g., 10.10.1.1) /EXACT_PATH_FROM_SHOWMOUNT with the path you got from the showmount command (e.g., /volume1/.srv/.unifi-drive/[Shared Drive Name]/.data) /mount/point with where you want the files to appear inside your container Step 3: Start Your Container Run the following command to start your container: docker compose up -d Step 4: Verify the Mount Check if your container is running: docker compose ps If it's running, you can access the container and verify the mount: docker compose exec [Your Docker Container name] bash # Once inside the container, check the mount: df -h # or mount | grep nfs # or ls -la /mount/point Try creating a test file to verify write access: echo "Hello from Docker" > /mount/point/test_file.txt Common Issues and Solutions [TODO] Conclusion Mounting Unaspro NFS shares as Docker volumes provides a convenient way to have persistent storage for your containers. The key is to verify the exact export path and use the correct mount options. This approach allows you to: Share data between containers Persist data beyond container lifecycles Leverage your existing Unaspro storage infrastructure Have you used NFS with Docker? Share your experiences in the comments!

Mar 5, 2025 - 12:10
 0
UNASPRO Shared Drives and Docker volumes mount

How to Mount Unaspro NFS Shares as Docker Volumes

If you're using a Unifi Unaspro NFS server and want to leverage it for persistent storage in your Docker containers, this guide will walk you through the process. This approach allows your containers to access shared storage that persists beyond container lifecycles.

Prerequisites

  • A Linux server with Docker installed
  • A Unaspro NFS server on your network
  • Basic understanding of Docker and NFS

Step 1: Verify Your NFS Exports

Before attempting to mount anything, it's crucial to verify what paths your Unaspro server is actually exporting. The Unifi dashboard might show one path, but the actual exported path could be different.

Settings - Services

Settings - Services

Run this command to see the available NFS shares:

showmount -e YOUR_UNASPRO_IP

For example:

showmount -e 10.1.1.1

This might return something like:

Export list for 10.1.1.1:
/volume1/.srv/.unifi-drive/[Shared Drive Name]/.data [YOUR_SERVER_IP]

Important: Note the exact path shown here. This is the actual path you'll need to use, not what might be shown in the Unifi dashboard.

Step 2: Create a docker-compose.yml File

Create a docker-compose.yml file with the following content:

version: '3'

services:
  your-service:
    image: ubuntu  # or any image you prefer
    command: tail -f /dev/null  # Keeps the container running
    volumes:
      - nfs-data:/mount/point
    # Add other container configurations as needed

volumes:
  nfs-data:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=YOUR_UNASPRO_IP,rw,nfsvers=3,nolock"
      device: ":/EXACT_PATH_FROM_SHOWMOUNT"

Replace:

  • YOUR_UNASPRO_IP with your Unaspro server IP (e.g., 10.10.1.1)
  • /EXACT_PATH_FROM_SHOWMOUNT with the path you got from the showmount command (e.g., /volume1/.srv/.unifi-drive/[Shared Drive Name]/.data)
  • /mount/point with where you want the files to appear inside your container

Step 3: Start Your Container

Run the following command to start your container:

docker compose up -d

Step 4: Verify the Mount

Check if your container is running:

docker compose ps

If it's running, you can access the container and verify the mount:

docker compose exec [Your Docker Container name] bash

# Once inside the container, check the mount:
df -h
# or
mount | grep nfs
# or
ls -la /mount/point

Try creating a test file to verify write access:

echo "Hello from Docker" > /mount/point/test_file.txt

Common Issues and Solutions

[TODO]

Conclusion

Mounting Unaspro NFS shares as Docker volumes provides a convenient way to have persistent storage for your containers. The key is to verify the exact export path and use the correct mount options.
This approach allows you to:

  • Share data between containers
  • Persist data beyond container lifecycles
  • Leverage your existing Unaspro storage infrastructure

Have you used NFS with Docker? Share your experiences in the comments!