Hello,
I installed RStudio-server in a container Docker with a Dockerfile (based on ubuntu 24.04). To install rstudio-server, I used the user root in the Dockerfile.
Now I want to run the container Docker and the rstudio-server but with a user rootless in the Docker image. I failed to run rstudio-server with a rootless user, I have errors. Is it a way to run rstudio-server with a rootless user ?
Thanks
I had a similar situation, but I'm using Apptainer instead of Docker (I think it will work for Docker too). It took me a while to figure out how to do it, but it's quite simple.
First, install r-base and rstudio-server from scratch in the container (I used an Ubuntu 24.04 image too). Then, edit two main files:
- As root, add these lines to /etc/rstudio/rserver.conf
server-daemonize=0
server-user=your_username
server-data-dir=/home/your_username/.rserver/datadir
- As root, add these lines to /etc/rstudio/database.conf
directory="/home/your_username/.rserver/db"
auto-create="1"
- Finally, as your rootless user, just create the directories before the first rserver run
mkdir -p /home/your_username/.rserver/db
mkdir -p /home/your_username/.rserver/datadir
rstudio-server start
In summary, you just need to change these two paths to a location where the user has write permissions.
Notes:
- Running Rstudio Server in rootless mode will disable multi-user stuff, so I opted to use with daemon mode disabled, but I think this change is not required.
- I'm using this on Windows 11 with WSL2 through Apptainer/Singularity container, including --contain option and it's working properly.
- I strongly recommend setting
www-address=127.0.0.1or another specific IP inrserver.conf. If it is left too open, anyone could connect without authentication and run commands as your user, even in containerized environments like mine.
Hello,
Thanks for the reply but I have always the same issue.
I followed your instructions and when I start rstudio-server, I have no issues. But when I connect with a web browser to http://localhost:8787, i have in the web browser the following error : ERR_TOO_MANY_REDIRECTS. And in the logs of my container, I have the following issue
rserver[21]: ERROR system error 2 (No such file or directory) [description: User not found., user-value: ]; OCCURRED AT rstudio::core::Error rstudio::core::system::User::Impl::populateUser(rstudio::core::system::User::Impl::GetPasswdFunc&, T) [with T = const char* rstudio::core::system::User::Impl::GetPasswdFunc = std::function<int(const char*, passwd*, char*, long unsigned int, passwd**)>] src/cpp/shared_core/system/User.cpp:94; LOGGED FROM: void rstudio::server::auth::handler::ensureDatabaseUser(const string&) src/cpp/server/auth/ServerAuthHandler.cpp:910
Do you have the same error ?
Thanks
Hello,
I understood my error.
At the end of my dockerfile, I use the user coder ("USER coder"). When my container starts, it uses directly this user without using a real login session. So some environment variables are not correctly defined and RStudio cannot start correctly. RStudio needs a complete login session.
I just add the environment variable "ENV USER=coder" in my dockerfile and now it is ok.
Thanks for your help.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.