This repo holds several files for my personal dockerized R environment including:
- RStudio (Further information about RStudio)
- Shiny (Further information about Shiny)
- Lots of usefull pre-installed packages (See a list of all installed packages here)
It is roughly maintained and from time to time adjusted to my needs.
💡 If you want to mount folders from your host system to with the container, make sure they are correctly described in the docker-compose.yml
file. If you don't want to mount anything, ignore this.
git clone https://github.com/joundso/r_datascience.git Rdatascience
cd Rdatascience
docker-compose up -d
-
On your host-machine, you can now open a webbrowser and go to page
localhost:8787
to see RStudio server. Login with the user-password-combination specified inDockerfiles/rdsc_base_j.dockerfile
and start working. :bulb: Default username isubuntu
, default password ispassword
. -
When you deploy a shiny app, it will be accessible via
localhost:3838
. -
The tag of the images corresponds to the current R version. The R version in an image with the tag
4.4.1
is (of course)R 4.4.1
. This also holds for sub-tags like4.4.1-9001
where some changes in the image like different installed R packages might be the reason for the sub tag but the R version is still4.4.1
. (Hint: All tags starting with0.*.*
do not match this criteria. These images were built before this convention came up.) -
If you want to run two (or more) instances of the image,
- run
bash ./start_rdatascience.sh
to spin up the first container, - open the
.env
file and uncomment the section for the ports for the second instance, - comment out the ports for the first instance
- run
bash ./start_rdatascience.sh
again to spin up the second instance (rundocker ps -a
to see if both containers are running).
- run
-
To shut down the container(s),
- run
bash ./stop_rdatascience.sh
to spin down the container with the currently enabled ports in the.env
file - if multiple instances are running, open the
.env
file and uncomment the section for the ports of the second instance and comment out the ports of the last instance which is already shut down. Repeat these steps until all containers are shut down. - Run
docker ps -a
to see if all containers are shut down correctly.
- run
-
To update the image, simply:
## Stop the current deployment: bash ./stop_rdatascience.sh ## alternatively: # docker-compose down ## Pull the most recent version of the repository: git pull origin master ## Pull the most recent image version: docker-compose pull ## Start the new version: docker-compose up -d
💡 If you want to use a custom docker-compose file, create it and assign the path to your custom dc-file in the .env
file to the variable CUSTOM_DOCKER_COMPOSE_FILE
. Then run the custom deplyment by running bash ./start_rdatascience.sh
.
To build all images new, run
## Run the script to build the image(s):
sudo bash ./build_rdsc.sh
- About RStudio Server: https://www.rstudio.com/products/rstudio/download-server/
- About Shiny: https://www.rstudio.com/products/shiny/
- RStudio and Shiny are trademarks of RStudio, Inc.
Big thanks to @kapsner for the inspiration of this fork: https://github.com/kapsner/docker_images!