Reputation: 4583
I am using Singularity 3.0 and trying to pull a container image from DockerHub and run it on a university cluster. I followed this recipe to get started.
singularity pull --name rstudio-3.5.2.sif docker://rocker/rstudio:3.5.2
singularity exec --bind example-project-1/:/home/rstudio/ rstudio-3.5.2.sif rserver --www-port 8787
The container process starts but when I try to connect via a browser I get the following error log.
01 Jan 2019 12:07:22 [rsession-pughdr] ERROR system error 30 (Read-only file system) [path=/home/pughdr/.rstudio, target-dir=]; OCCURRED AT: rstudio::core::Error rstudio::core::FilePath::createDirectory(const string&) const /home/ubuntu/rstudio/src/cpp/core/FilePath.cpp:846; LOGGED FROM: rstudio::core::FilePath rstudio::core::system::userSettingsPath(const rstudio::core::FilePath&, const string&) /home/ubuntu/rstudio/src/cpp/core/system/PosixSystem.cpp:486
01 Jan 2019 12:07:22 [rsession-pughdr] ERROR system error 30 (Read-only file system) [path=/home/pughdr/.rstudio, target-dir=]; OCCURRED AT: rstudio::core::Error rstudio::core::FilePath::createDirectory(const string&) const /home/ubuntu/rstudio/src/cpp/core/FilePath.cpp:846; LOGGED FROM: int main(int, char* const*) /home/ubuntu/rstudio/src/cpp/session/SessionMain.cpp:1689
Seems that the file system in the container is only read-only. How do I build (or run) the container such that the container's file system is writable?
Update:
I was able to get the RStudio Server running on the university cluster as follows.
singularity exec --home my-project-directory rstudio-3.5.2.sif rserver --www-port 8787
This seems to work because Singularity automatically mounts the user's home directory on the host into the container and I redefined my home directory to be my-project-directory
in the above.
However I still cannot install R packages into the container as the file system is not writable.
> install.packages(c("plyr", "dply", "tidyr", "ggplot2"))
Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel) cancel
Error in install.packages : unable to install packages
Original question still stands: how can I create a Singularity 3.* container that has a writable filesystem? If this is not possible, explanation as to why would be appreciated.
Upvotes: 7
Views: 7769
Reputation: 91
Reading in this article, apparently there is a solution to the problem concerning package installation:
Create an .Renviron
file in your home directory and set R_LIBS_USER
as follows:
# User-installed R packages go into their home directory
echo 'R_LIBS_USER=~/R/%p-library/%v' >> ${HOME}/.Renviron
This solved the package-installation-issue for me.
Upvotes: 2
Reputation: 3775
You can create a sandbox folder with --sandbox option .
Also you probably can create a Virtual Machine / vagrant for singularity 2.5
Upvotes: 0
Reputation: 181
try --writable flag in your container:
singularity build --writable rstudio-3.5.2.sif docker://rocker/rstudio:3.5.2
singularity exec --writable --bind example-project-1/:/home/rstudio/ rstudio-3.5.2.sif rserver --www-port 8787
Upvotes: 1