I'm using Docker image rocker/rstudio:4.0.3
on Ubuntu 20.04.
I found I could not save files in the directories shared between the host and the container via -v
option.
How can I save files edited on RStudio in a container into a filesystem of host OS ?
The process I tried follows:
I launched a container with this command.
docker run -v $(pwd)/R:/home/rstudio/work -e PASSWORD=password -p 8787:8787 rocker/rstudio:4.0.3
I accessed to the host os's 8787 port by a browser and logged in.
And making a file and saving it as /home/rstudio/work/a.R
, then an error occured.
Actually, the owner of the directory that is shared with the host os is root
but RStudio process is run by rstudio
user and the permission is rwxr-xr-x
. So as far as I understand, we can not make files from the RStudio process.
rstudio@b4d0b040cc37:~$ pwd
/home/rstudio
rstudio@b4d0b040cc37:~$ ls -al
total 32
drwxr-xr-x 1 rstudio rstudio 4096 Feb 26 09:01 .
drwxr-xr-x 1 root root 4096 Feb 16 17:32 ..
-rw------- 1 rstudio rstudio 16 Feb 26 09:01 .bash_history
drwxr-xr-x 3 rstudio rstudio 4096 Feb 26 08:44 .config
drwxr-xr-x 3 rstudio rstudio 4096 Feb 26 08:44 .local
drwxr-xr-x 2 root root 4096 Feb 26 07:23 work
rstudio@b4d0b040cc37:~$
How can I save files into the host OS from the RStudio IDE ?