Setting Up and Using External Drives with Colima and Docker on a Mac Mini


There are different requirements depending on whether the external drive is a NAS over a network or a usb drive.

NAS Attached Via Network Cable

  1. Set up a shared folder to be mounted.

  2. Do NOT use smb. Use NFS. The reason NFS has to be used is because Colima will not be able to connect to the NAS through password connection. Instead, with NFS Colima can be set up to be authenticated via its IP Address.

  3. Make sure on Synology to use `MAP all users to admin.”

Synology NFS Settings:

  • Location: Control Panel > Shared Folder > MediaAssets > Edit > NFS Permissions
  • Make sure to add the IP address for the host machine
  • Privilege: Read/Write
  • Squash: “Map all users to admin” (KEY SETTING)
  • Allow connections from non-privileged ports: ✅ ENABLED
  • Root squash: NOT enabled

Mac Mini Mount Command:

sudo mount_nfs -o vers=3,resvport 192.168.x.xx:/volume1/MediaAssets /usr/local/nas

Resvport is the igp address of the host computer. Make sure that you reserve that IP address to your host machine

Result:

  • Mount accessible by regular user without sudo ✅
  • Files show as 1026:*lpoperator but readable/writable ✅
  • Directory permissions: drwxrwxrwx root:wheel

Key Breakthrough:

The “Map all users to admin” setting on Synology resolved the permission issue, allowing regular user access to NFS mount despite root ownership.

Previous Attempts (Failed):

  • SMB mount: Only accessible via root, blocked Colima
  • NFS with default settings: Root-only access
  • macOS mount options (uid/gid): Not supported

For A Connected USB Drive.

Mount External Drive(s) on the Mac

  1. Physically connect the SSD drive to your Mac Mini.

  2. Check mount points:

    bash ls /Volumes

    • You should see /Volumes/MediaAssets (NAS) and /Volumes/SSDMediaManager` (SSD).

Configure Colima to See Those Drives

  1. Edit your Colima config file.

    colima stop

    colima start –edit

Make sure that –edit is used. This will allow you to edit your Colima configuration file in your text editor. Then when you save the file, it will automatically continue to load Colima. Do not try to modify the config file without using Colima start –edit or you will find that the config files gets replaced with the default file/settings.

Ensure the config is edited to include:

   mountType: virtiofs

   mounts:
     - location: /Users
       writable: true
     - location: /Volumes/MediaAssets (the NAS share)
       writable: false
     - location: /Volumes/SSDMediaManager (the SSD share)
       writable: true
     - location: /Users/PROJECT/DIRECTORY
       writable: true
     - location: ~/.ssh (Mount.ssh to have access to git inside container)
       writable: true

MAKE SURE YOU MOUNT THE PROJECT DIRECTORY OR COLIMA WILL NOT SEE THE PROJECT DIRECTORY

DO NOT USE commands like colima start --mount-type virtiofs. You will lose non-default setting. ONLY USE colima start --edit.

To check what is mounted in colima

colima ssh

df -h

Mount Drives within the your app via via docker-compose.yml.

services: app: volumes: - /Volumes/MediaAssets:/nas:ro - /Volumes/SSDMediaManager:/ssd:rw

- `/nas` becomes the source (read-only).
- `/ssd` becomes the working directory (read-write).

Ensure Mounts Survive Mac Reboots

Persistence requirements:

  • Ensure the drives auto-mount at Mac login:
    • For NAS: Add the mounted share to Login Items in System Settings.
    • For SSD: Keep physically connected ➔ MacOS will remount.

After a reboot:

  • Confirm /Volumes/MediaAssets and /Volumes/SSDMediaManager exist.
  • Then start Colima:
    colima start
    

Containers and devcontainers will work normally if mounts exist.

Visit Emlekezik.com