extrobe Posted May 26, 2017 Share Posted May 26, 2017 (edited) There's no existing docker in the CA store for R / R Studio, but there are generic Dockers on Docker.com I went through the process of getting this working with unRaid, and wanted to share how I achieved this. **This is a work in progress!** I'll confess to not really knowing what I'm doing, therefore, some bits may not be quite how they should / could be, but this should get you to a working R Studio Environment. There are a few bits I either think I need / know I want to change - I'll outlines these as well. Prerequisites Already have the Community Applications plugin installed Outstanding: Create a pre-defined XML file (including web gui link & icon) Web gui link now added Icon url now added https proxy via letsencrypt/nginx *turns our https is a R Studio Pro feature only Understanding if the Packages installation directory should be / needs to be a user-defined directory Some progress made on this Outline of the process: Enable Community Applications to search Docker.com Create the share/directory Find the right R Studio Docker Configure the docker template access the web Ui Detailed Process Enable Community Applications to search Docker.com from unRaid, select the Settings tab Under Community Applications banner, select General Settings Near the bottom, find the entry stated 'Enable additional search results from dockerHub?' Change to 'Yes' Apply Done 2. Create the share/directory Create a share or directory dedicated to your R files / Projects. If you have an SSD cache drive, you may want to utilise it, so I would suggest a dedicated share set to use the cache drive only. I used a dedicated share, name r 3. Find the right R Studio Docker There are a variety of R Studio Dockers available. The best ones appear to link back to the Rocker Project. Within the Rocker project, there are various dockers, but I'm using 'tidyverse', which includes the base R code, R Studio and a good selection of the most popular R library's available already added to the docker. From the Apps tab, search 'tidyverse' you should get no results back select 'Get more results from DockerHub' locate the docker 'tidyverse' from the author 'rocker' select 'add' 4. Configure the container You should now be at the container configuration screen. We need to manually map the ports & paths to the container Give your docker a name (if you wish) select 'Add another Path, Port or variable' Config Type: Port Name: HTTP Port Container Port: 8787 Host Port: 8787 connection Type: TCP Add Repeat above step to add another port Config Type: Port name: Shiny Port Container Port: 3838 Host Port: 3838 Connection Type: TCP Add Add another item, but this time a path - this will hold your user-content and workspace session files Config Type: Path Name: Workspace Container Path: /home/rstudio Host Path: /mnt/user/r/ (or whatever share/directory you want to use) Add Add another path item - we will use this space as an install directory for extra library's you add Config Type: Path Name: Custom Library Install Path Container Path: /usr/local/lib/R/custom-library Host Path: /mnt/user/appdata/rstudio At the top-right of the docker add screen, there's a toggle switch that says 'Basic View'. Click this to go to advanced view Where it says 'WebUI', enter http://[IP]:[PORT:8787]/ Where is says 'Icon URL', enter https://cdn.rawgit.com/extrobe/un-r/c7b98d12499aef04180a6bd4f18c77dd2c1155bb/rstudio-icon-s.png Apply this should now pull down and install the docker 5. Access the webUi Browse to http://<yourip>:8787 Login using rstudio/rstudio run the R command .libPaths( c( "/usr/local/lib/R/custom-library",.libPaths()) ) This adds your custom folder to the list of library directories, and sets it as the default. You may want/need to keep this to run as part of your regular R code to ensure the additional libraries are always available. there you have it. Your workspace files should all save into your /mnt/user/r share. I assume the directory where the package files get saved / installed to should be a mapped directory as well. I tried setting this by mapping /usr/local/lib/R to the appdata folder, but this broke it. I'll have another look at it at a later date! That said, I've installed a couple of extra packages, restarted the server and so far they've been persistent. The underlying Docker File does not appear to provide support to install the config/library files to a custom location. Therefore, any packages we add and any settings we change will not be persistent (they won't always get overwritten, but can / does happen, eg with a new docker file being released). We get around the library/package install location by adding a custom library directory. Edited May 29, 2017 by extrobe Quote Link to comment
egeis Posted November 16, 2019 Share Posted November 16, 2019 (edited) Tried to do everything above with the geospatial version. Getting the following error: [1m[31mERROR[39m: You must set a unique PASSWORD (not 'rstudio') first! e.g. run with: docker run -e PASSWORD=[92m<YOUR_PASS>[39m -p 8787:8787 rocker/rstudio (B[m Tried again with tidyverse... same error. I'm gonna add extra parameters to create a password... It worked! Didn't expect to have to use the extra parameters. Anyone doing this, Add under extra parameters: -e PASSWORD='<YourPassword>' Edited November 16, 2019 by egeis Troubleshooting in real-time Quote Link to comment
Squid Posted November 16, 2019 Share Posted November 16, 2019 28 minutes ago, egeis said: Tried to do everything above with the geospatial version. Getting the following error: [1m[31mERROR[39m: You must set a unique PASSWORD (not 'rstudio') first! e.g. run with: docker run -e PASSWORD=[92m<YOUR_PASS>[39m -p 8787:8787 rocker/rstudio (B[m Tried again with tidyverse... same error. I'm gonna add extra parameters to create a password... It worked! Didn't expect to have to use the extra parameters. Anyone doing this, Add under extra parameters: -e PASSWORD='<YourPassword>' What you wanted to do is add another port path variable and select variable The name would be PASSWORD and the value would be whatever you want it to be 1 Quote Link to comment
egeis Posted November 16, 2019 Share Posted November 16, 2019 (edited) Followup... My goal with this docker is to host a dashboard for myself. When I launch a shiny app, It's listening on the localhost. I can use the arguments: > shiny::runApp('FirstApp',port = 3838,launch.browser = FALSE) Listening on http://127.0.0.1:3838 So, I configured the ports as above. When I go to my IP, "http://[IP]:3838", the page won't load... which tells me something else needs to happen. Any ideas what that might be? Alright, so I kept tweeking. When running the app, I need to add the host argument to be the IP address assigned by docker. For example: > shiny::runApp('FirstApp',port = 3838,host = '172.17.0.6',launch.browser = FALSE) Listening on http://172.17.0.6:3838 Then... I go to the address http://[MyUnraidIP]:3838 ... and there's shiny!! Edited November 16, 2019 by egeis Troubleshooting in real-time Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.