Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jzombie/sshfs-mac-docker
SSHFS on macOS without macFUSE or kernel extensions.
https://github.com/jzombie/sshfs-mac-docker
docker macos sshfs-mounting
Last synced: 2 days ago
JSON representation
SSHFS on macOS without macFUSE or kernel extensions.
- Host: GitHub
- URL: https://github.com/jzombie/sshfs-mac-docker
- Owner: jzombie
- Created: 2024-01-01T07:31:45.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-06T21:54:48.000Z (10 months ago)
- Last Synced: 2024-01-26T14:44:16.957Z (10 months ago)
- Topics: docker, macos, sshfs-mounting
- Language: Dockerfile
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sshfs-mac-docker
_Experimental_ repo to provide SSHFS to Mac *WITHOUT* installing macFUSE and patching the kernel with a custom kext.
Remote filesystem is mounted in container via SSHFS and exposed to Mac via Samba.
---
Note: It is _highly_ recommended to use [OrbStack](https://orbstack.dev/). Docker Desktop will not work for this without modifying the network routing.
---
## Why Samba instead of Volume Mounts?
The standard Docker volume mounts won't work for this purpose because they are designed for local file systems and do not natively support SSH-based file system connections. The sshfs-mac-docker solution uses SSHFS to overcome this limitation, allowing remote file systems to be mounted inside Docker containers as if they were local volumes, which is not achievable with Docker's standard volume mounting features.
----
## Build the container
```bash
docker build -t docker-sshfs .
```## Start the container
In one terminal shell, run:
```bash
docker run --privileged --name docker-sshfs -p 127.0.0.1:139:139 -p 127.0.0.1:445:445 docker-sshfs
```Samba is configured to listen on ports 139 and 445 and is accessible only from localhost.
## Mounting Remote Filesystem
In another terminal:
```bash
docker exec -it docker-sshfs bash
```You'll be dropped into the container at this point.
Run (replacing `user@host:path` with your SSHFS endpoint):
```bash
sshfs -o allow_other,uid=1000,gid=1000 user@host:path /samba-share
```allow-other is needed to be able to access via mac samba
uid=1000,gid=1000 is needed for write-access (otherwise, it will be read-only if omitted)## Connecting to Samba share in container
1. Find Docker IP of container (localhost doesn't seem to work for this)
```bash
docker inspect --format '{{ .NetworkSettings.IPAddress }}' docker-sshfs
```2. Navigate to Finder -> Go -> Connect to Server
3. Enter `smb://ip-of-docker-container``
If all goes well, connect as `Guest`.
4. Open `Finder`, navigate to `Network` tab, find the IP of the Docker container, and you should now have access to remote files
## Unmounting Remote Filesystem
If wanting to unmount the SSHFS endpoint (without stopping the container):
```bash
fusermount -u /samba-share
```If getting message
```bash
fusermount: failed to unmount /samba-share: Device or resource busy
```...unmount the drive from Finder (or just stop the container)
## Not wanting Docker?
Maybe this will work instead: https://github.com/macos-fuse-t/fuse-t