Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for UNASPRO Shared Drives and Docker volumes mount
Andreas Koutsoukos
Andreas Koutsoukos

Posted on • Edited on

     

UNASPRO Shared Drives and Docker volumes mount

How to Mount Unaspro NFS Shares as Docker Volumes

If you're using a Ubiquiti UNAS Pro and want to use its NFS feature to store Docker container data on shared drives, this guide will walk you through the process.

Prerequisites

  • A Linux server with Docker installed
  • A Ubiquiti UNAS Pro
  • Basic understanding of Docker

Step 1: Verify Your NFS Exports

Before attempting to mount anything, it's crucial to verify which paths your Ubiquiti UNAS Pro is actually exporting. The Settings -> Services dashboard might display a mount command like:

sudo mount -t nfs 10.1.1.1:/var/nfs/shared/[Shared Drive Name] /mnt
Enter fullscreen modeExit fullscreen mode

However, this exported path may not work inside the Docker container.

Image 1
Settings - Services

Image 2
Settings - Services

Use Case: Storing Docker Container Volume Data on Ubiquiti UNAS Pro

Scenario:

A user has a Ubiquiti UNAS Pro and a Linux-based server running Docker. They want to store Docker container volume data on the Ubiquiti UNAS Pro using NFS to ensure centralized storage, easy backups, and better data persistence across container restarts.

Solution:

  • Enable NFS on the Ubiquiti UNAS Pro and configure exported shared drives.
  • Configure Docker volumes to use the mounted NFS path for persistent storage.

Benefit:

This setup ensures that container data is stored securely on the Ubiquiti UNAS Pro, making it easier to manage, back up, and access from multiple servers if needed.

Setup

Make sure that you have enabled the NFS share in the Ubiquiti UNAS Pro settings - service UI and that the both machines Ubiquiti UNAS Pro and Linux server are at the same network.

Login to your server by SSH and run this command to see the available NFS shares, :

showmount -e YOUR_UNASPRO_IP
Enter fullscreen modeExit fullscreen mode

For example:

showmount -e 10.1.1.1
Enter fullscreen modeExit fullscreen mode

This might return something like:

Export list for 10.1.1.1:/volume1/.srv/.unifi-drive/[Shared Drive Name]/.data [YOUR_LINUX_SERVER_IP]
Enter fullscreen modeExit fullscreen mode

The [YOUR_LINUX_SERVER_IP] comes from the Ubiquiti UNAS Pro NFS settings see the Image 2

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

Step 2: Create a docker-compose.yml File on your Linux server

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 neededvolumes:  nfs-data:    driver: local    driver_opts:      type: nfs      o: "addr=YOUR_UNASPRO_IP,rw,nfsvers=3,nolock"      device: ":/EXACT_PATH_FROM_SHOWMOUNT"
Enter fullscreen modeExit fullscreen mode

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
Enter fullscreen modeExit fullscreen mode

Step 4: Verify the Mount

Check if your container is running:

docker compose ps
Enter fullscreen modeExit fullscreen mode

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# ormount | grep nfs# orls -la /mount/point
Enter fullscreen modeExit fullscreen mode

Try creating a test file to verify write access:

echo "Hello from Docker" > /mount/point/test_file.txt
Enter fullscreen modeExit fullscreen mode

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!

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
vj_andrei profile image
Andreas Koutsoukos
Full-Time learner and Open-Sourcerer. Focuses on UI and JavaScript. Makes web apps, Sketch tools, Likes 😸 and 🦄
  • Location
    Espoo, Finland
  • Education
    Vocational school
  • Work
    UI Engineer at Siili Solutions Ltd.
  • Joined
• Edited on• Edited

if you like to have subfolder on the Unaspro drive make sure that you have created the subfolder on the drive and change the device: to ":/volume1/.srv/.unifi-drive/[Your drive name]/.data/[Your subfolder name]"

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Full-Time learner and Open-Sourcerer. Focuses on UI and JavaScript. Makes web apps, Sketch tools, Likes 😸 and 🦄
  • Location
    Espoo, Finland
  • Education
    Vocational school
  • Work
    UI Engineer at Siili Solutions Ltd.
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp