Docker Community Forums

Share and learn in the Docker community.

Can I mount a remote sftp file server into a container?

I have docker installed on an intel nuc and runs a plex server.
Works good but now I want to get access to a friends QNAP NAS. He has set up sftp-access for me and I can access it with filezilla without problem. But filezilla can’t mount a volume/disk for me.
And here is my problem, plex can only access local file system so I have to mount the sftp in order to get plex to read the storage.
I tested to install plex on a windows10 and installed Raidrive to mount the sftp, and this worked perfectly.
But I don’t want to run this on windows, I want it to work on my docker server.
Is there a way to solve this?

I can only speak for linux-based OS’es: you typicaly have two approaches

1: mount the remote storage in a /path/on/host on your linux host and use a bind-mount (-v /path/on/host:/path/in/container) to expose it to the container.

2: install and use a volume plugin.

For the first case, Google should provide some usefull results if you search for “sftp mount fstab”. Alternativly you can look for “sshfs mount fstab”. sftp and sshfs both use ssh to transport data, but are different things.

For the second case, I am note sure if there is a volume plugin for sftp, but there is an alternative that should do the trick:

This post was flagged by the community and is temporarily hidden.

You need to install a SSH server in the image you are running, or make sure one is already installed. Then you need to map the ssh port (default 22) on your container to the host’s port so you can reach your container from outside host. For example:

docker run -p 10022:22 app_container
If running on AWS check your security group for that ec2 instance you are running that container on to allow host port (10022 as in example above) to be accessible from outside.