Pregunta:
Utilizo SSHFS para montar un sistema de archivos remoto en mi host y quiero poder acceder a él desde dentro de un contenedor Docker.
Monto el sistema de archivos remoto
sshfs -o idmap=user,uid=$(id -u),gid=$(id -g) user@remote:directory /path/to/sshfs
Y, al usar Docker, obtengo los siguientes errores dependiendo de mí usando --mount
:
docker run -it -v /path/to/sshfs:/target myimage bash
docker: Error response from daemon: error while creating mount source path '/path/to/sshfs': mkdir /path/to/sshfs: file exists.
o -v
:
docker run -it --mount src=/path/to/sshfs,target=/target,type=bind myimage bash
docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /path/to/sshfs.
See 'docker run --help'
¿Es posible montar un punto de montaje sshfs en un contenedor?
Respuesta:
Requiere los siguientes pasos:
-
descomente
user_allow_other
en/etc/fuse.conf
-
desmontar el sistema de archivos FUSE
-
vuelva a montar el sistema de archivos FUSE con
sshfs -o allow_other user@....
(asegúrese de incluir la opción-o allow_other
) -
intente poner en marcha el contenedor de nuevo