rocker-org / rocker-versioned2

Run current & prior versions of R using docker. rocker/r-ver, rocker/rstudio, rocker/shiny, rocker/tidyverse, and so on.
https://rocker-project.org
GNU General Public License v2.0
414 stars 180 forks source link

Getting "device not found, try 'modprobe fuse' first" error on using sshfs #286

Closed hongooi73 closed 2 years ago

hongooi73 commented 2 years ago

Hi Dirk/Carl,

I'm trying to use sshfs to connect to the filesystem on one of our servers. Everything works when I do this inside an Ubuntu-based container (jupyter/datascience-notebook to be precise) but I get the above error when I try it with rocker/rstudio.

Things are complicated slightly by the fact that I also have to set some proxy info/copy certs into the image for it to connect to our network. Here is a minimal example of the dockerfile I use to do this:

FROM rocker/rstudio:latest

USER root

RUN echo 'Acquire::http::proxy "http://internal.proxy.server";' >> /etc/apt/apt.conf.d/99proxy
ENV HTTP_PROXY http://internal.proxy.server
ENV HTTPS_PROXY http://internal.proxy.server
ENV http_proxy http://internal.proxy.server
ENV https_proxy http://internal.proxy.server
ENV NO_PROXY artifactory.srv.westpac.com.au
ENV SSL_CERT_DIR /etc/ssl/certs
ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt

# Point utilities to zscaler certificate
COPY certificates/* /usr/local/share/ca-certificates/
RUN update-ca-certificates

USER rstudio

ENV HTTP_PROXY http://internal.proxy.server
ENV HTTPS_PROXY http://internal.proxy.server
ENV http_proxy http://internal.proxy.server
ENV https_proxy http://internal.proxy.server
ENV NO_PROXY artifactory.srv.westpac.com.au
ENV SSL_CERT_DIR /etc/ssl/certs
ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt

In the image, I then run

apt update
apt install sshfs

mkdir -p /opt/sas
sshfs -o idmap=user myacct@internal.sas.server:/opt/sas /opt/sas

But this results in the error shown above. The same code works without issue in an Ubuntu container, as noted.

Is there some trick to getting sshfs to work on rocker and/or Debian?

eddelbuettel commented 2 years ago

Good question. I only ever played a little with sshfs on my local machines here, and very rarely with remote ones I had ssh access for.

eitsupi commented 2 years ago

The base image of rocker/rstudio:latest is now rocker/r-ver:4.1.2, and the base image of rocker/r-ver:4.1.2 is ubuntu:focal (same with jupyter/datascience-notebook). Is it work fine on rocker/r-ver:4.1.2 ?

If I search for the error I can find the answer that we need the --privileged option of the docker run command. https://github.com/s3fs-fuse/s3fs-fuse/issues/647

hongooi73 commented 2 years ago

@eitsupi adding --privileged did the trick. Thanks so much!

Bit weird that Ubuntu doesn't need this flag, but oh well, as long as it works.

eitsupi commented 2 years ago

--privileged is generally considered to be undesirable for security reasons, I believe.

If it works for the root user on ubuntu:focal, I have no idea why it would not work for the root user on rocker/rstudio. What was the user when you ran the command in each container? The default user of jupyter/datascience-notebook is jovyan, did you run the command as jovyan?