Commit 2a5f7800 authored by Mark McCahill's avatar Mark McCahill
Browse files

update for new version


Signed-off-by: Mark McCahill's avatarMark McCahill <mark.mccahill@duke.edu>
parent 0203d566
# mccahill/r-studio
#
# VERSION 0.3
# VERSION 0.4
FROM ubuntu:12.04
FROM ubuntu:14.04
MAINTAINER Mark McCahill "mark.mccahill@duke.edu"
RUN echo "deb http://cran.cnr.Berkeley.edu/bin/linux/ubuntu precise/" >> /etc/apt/sources.list
# get R from a CRAN archive
RUN echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list
RUN DEBIAN_FRONTEND=noninteractive apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
RUN apt-get update && \
apt-get install
apt-get upgrade -y
# we want OpenBLAS for faster linear algebra as described here: http://brettklamer.com/diversions/statistical/faster-blas-in-r/
RUN apt-get install -y \
libopenblas-base
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes \
r-base \
r-base-dev
#Utilities
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
......@@ -26,8 +37,10 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
sudo \
libcurl4-openssl-dev
# we need TeX for the rmarkdown package in RStudio - this backport seems to work
RUN apt-add-repository ppa:texlive-backports/ppa
RUN apt-get update && \
apt-get upgrade -y
# we need TeX for the rmarkdown package in RStudio
# TeX
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
......@@ -36,108 +49,235 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
texlive-latex-extra \
texlive-pstricks
# get R from the CRAN archive at http://cran.cnr.Berkeley.edu
RUN DEBIAN_FRONTEND=noninteractive apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes \
r-base \
r-base-dev
# R-Studio
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
gdebi-core \
libapparmor1
RUN DEBIAN_FRONTEND=noninteractive wget http://download2.rstudio.org/rstudio-server-0.98.1028-amd64.deb
RUN DEBIAN_FRONTEND=noninteractive gdebi -n rstudio-server-0.98.1028-amd64.deb
RUN rm rstudio-server-0.98.1028-amd64.deb
RUN DEBIAN_FRONTEND=noninteractive wget http://download2.rstudio.org/rstudio-server-0.98.1103-amd64.deb
RUN DEBIAN_FRONTEND=noninteractive gdebi -n rstudio-server-0.98.1103-amd64.deb
RUN rm rstudio-server-0.98.1103-amd64.deb
# update the R packages we will need for knitr
RUN DEBIAN_FRONTEND=noninteractive wget \
http://cran.r-project.org/src/contrib/knitr_1.8.tar.gz \
http://cran.r-project.org/src/contrib/yaml_2.1.13.tar.gz \
http://cran.r-project.org/src/contrib/htmltools_0.2.6.tar.gz \
http://cran.r-project.org/src/contrib/caTools_1.17.1.tar.gz \
http://cran.r-project.org/src/contrib/bitops_1.0-6.tar.gz \
http://cran.r-project.org/src/contrib/digest_0.6.5.tar.gz \
http://cran.r-project.org/src/contrib/stringr_0.6.2.tar.gz \
http://cran.r-project.org/src/contrib/markdown_0.7.4.tar.gz \
http://cran.r-project.org/src/contrib/highr_0.4.tar.gz \
http://cran.r-project.org/src/contrib/formatR_1.0.tar.gz \
http://cran.r-project.org/src/contrib/evaluate_0.5.5.tar.gz \
http://cran.r-project.org/src/contrib/mime_0.2.tar.gz
http://mirrors.nics.utk.edu/cran/src/contrib/knitr_1.10.5.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/yaml_2.1.13.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/htmltools_0.2.6.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/caTools_1.17.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/bitops_1.0-6.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/digest_0.6.8.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/stringr_1.0.0.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/markdown_0.7.7.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/highr_0.5.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/formatR_1.2.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/evaluate_0.7.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/mime_0.3.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/stringi_0.5-5.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/magrittr_1.5.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL \
bitops_1.0-6.tar.gz \
caTools_1.17.1.tar.gz \
digest_0.6.5.tar.gz \
digest_0.6.8.tar.gz \
htmltools_0.2.6.tar.gz \
yaml_2.1.13.tar.gz \
stringr_0.6.2.tar.gz \
highr_0.4.tar.gz \
formatR_1.0.tar.gz \
evaluate_0.5.5.tar.gz \
mime_0.2.tar.gz \
markdown_0.7.4.tar.gz \
knitr_1.8.tar.gz
stringi_0.5-5.tar.gz \
magrittr_1.5.tar.gz \
mime_0.3.tar.gz \
stringr_1.0.0.tar.gz \
highr_0.5.tar.gz \
formatR_1.2.tar.gz \
evaluate_0.7.tar.gz \
markdown_0.7.7.tar.gz \
knitr_1.10.5.tar.gz
RUN rm \
evaluate_0.5.5.tar.gz \
formatR_1.0.tar.gz \
highr_0.4.tar.gz \
markdown_0.7.4.tar.gz \
stringr_0.6.2.tar.gz \
knitr_1.8.tar.gz \
evaluate_0.7.tar.gz \
formatR_1.2.tar.gz \
highr_0.5.tar.gz \
markdown_0.7.7.tar.gz \
stringi_0.5-5.tar.gz \
magrittr_1.5.tar.gz \
stringr_1.0.0.tar.gz \
knitr_1.10.5.tar.gz \
yaml_2.1.13.tar.gz \
htmltools_0.2.6.tar.gz \
caTools_1.17.1.tar.gz \
bitops_1.0-6.tar.gz \
digest_0.6.5.tar.gz \
mime_0.2.tar.gz
digest_0.6.8.tar.gz \
mime_0.3.tar.gz
# dependency for R XML library
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
libxml2 \
libxml2-dev
# R packages we need for devtools - and we need devtools to be able to update the rmarkdown package
RUN DEBIAN_FRONTEND=noninteractive wget \
http://cran.r-project.org/src/contrib/rstudioapi_0.1.tar.gz \
http://cran.r-project.org/src/contrib/devtools_1.6.1.tar.gz \
http://cran.r-project.org/src/contrib/httr_0.5.tar.gz \
http://cran.r-project.org/src/contrib/RCurl_1.95-4.5.tar.gz \
http://cran.r-project.org/src/contrib/memoise_0.2.1.tar.gz \
http://cran.r-project.org/src/contrib/whisker_0.3-2.tar.gz \
http://cran.r-project.org/src/contrib/jsonlite_0.9.14.tar.gz \
http://cran.r-project.org/src/contrib/downloader_0.3.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL jsonlite_0.9.14.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL memoise_0.2.1.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL whisker_0.3-2.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL RCurl_1.95-4.5.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL httr_0.5.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL rstudioapi_0.1.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL devtools_1.6.1.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL downloader_0.3.tar.gz
http://mirrors.nics.utk.edu/cran/src/contrib/rstudioapi_0.3.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/brew_1.0-6.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/roxygen2_4.1.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/rversions_1.0.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/git2r_0.10.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/devtools_1.8.0.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/R6_2.0.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/httr_1.0.0.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/RCurl_1.95-4.7.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/BH_1.58.0-1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/xml2_0.1.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/curl_0.9.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/jsonlite_0.9.16.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/downloader_0.3.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/memoise_0.2.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/Rcpp_0.11.6.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/plyr_1.8.3.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/XML_3.98-1.3.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/whisker_0.3-2.tar.gz
RUN rm \
jsonlite_0.9.14.tar.gz \
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL \
jsonlite_0.9.16.tar.gz \
memoise_0.2.1.tar.gz \
whisker_0.3-2.tar.gz \
curl_0.9.tar.gz \
RCurl_1.95-4.7.tar.gz \
Rcpp_0.11.6.tar.gz \
plyr_1.8.3.tar.gz \
R6_2.0.1.tar.gz \
httr_1.0.0.tar.gz \
rstudioapi_0.3.1.tar.gz \
brew_1.0-6.tar.gz \
roxygen2_4.1.1.tar.gz \
XML_3.98-1.3.tar.gz \
BH_1.58.0-1.tar.gz \
xml2_0.1.1.tar.gz \
rversions_1.0.1.tar.gz \
git2r_0.10.1.tar.gz \
devtools_1.8.0.tar.gz \
downloader_0.3.tar.gz
RUN rm \
jsonlite_0.9.16.tar.gz \
memoise_0.2.1.tar.gz \
RCurl_1.95-4.5.tar.gz \
httr_0.5.tar.gz \
devtools_1.6.1.tar.gz \
rstudioapi_0.1.tar.gz \
whisker_0.3-2.tar.gz \
RCurl_1.95-4.7.tar.gz \
Rcpp_0.11.6.tar.gz \
plyr_1.8.3.tar.gz \
R6_2.0.1.tar.gz \
httr_1.0.0.tar.gz \
rstudioapi_0.3.1.tar.gz \
brew_1.0-6.tar.gz \
roxygen2_4.1.1.tar.gz \
XML_3.98-1.3.tar.gz \
BH_1.58.0-1.tar.gz \
xml2_0.1.1.tar.gz \
curl_0.9.tar.gz \
rversions_1.0.1.tar.gz \
git2r_0.10.1.tar.gz \
devtools_1.8.0.tar.gz \
downloader_0.3.tar.gz
# libraries Eric Green wanted
RUN DEBIAN_FRONTEND=noninteractive wget \
http://mirrors.nics.utk.edu/cran/src/contrib/lubridate_1.3.3.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/ggplot2_1.0.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/Rcpp_0.11.6.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/RColorBrewer_1.1-2.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/dichromat_2.0-0.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/colorspace_1.2-6.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/munsell_0.4.2.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/labeling_0.3.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/scales_0.2.5.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/stargazer_5.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/reshape2_1.4.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/gtable_0.1.2.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/proto_0.3-10.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/minqa_1.2.4.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/nloptr_1.0.4.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/RcppEigen_0.3.2.4.0.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/lme4_1.1-8.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL \
Rcpp_0.11.6.tar.gz \
lubridate_1.3.3.tar.gz \
gtable_0.1.2.tar.gz \
RColorBrewer_1.1-2.tar.gz \
dichromat_2.0-0.tar.gz \
colorspace_1.2-6.tar.gz \
munsell_0.4.2.tar.gz \
labeling_0.3.tar.gz \
scales_0.2.5.tar.gz \
proto_0.3-10.tar.gz \
reshape2_1.4.1.tar.gz \
ggplot2_1.0.1.tar.gz \
stargazer_5.1.tar.gz \
minqa_1.2.4.tar.gz \
nloptr_1.0.4.tar.gz \
RcppEigen_0.3.2.4.0.tar.gz \
lme4_1.1-8.tar.gz
RUN rm \
Rcpp_0.11.6.tar.gz \
lubridate_1.3.3.tar.gz \
gtable_0.1.2.tar.gz \
RColorBrewer_1.1-2.tar.gz \
dichromat_2.0-0.tar.gz \
colorspace_1.2-6.tar.gz \
munsell_0.4.2.tar.gz \
labeling_0.3.tar.gz \
scales_0.2.5.tar.gz \
proto_0.3-10.tar.gz \
reshape2_1.4.1.tar.gz \
ggplot2_1.0.1.tar.gz \
stargazer_5.1.tar.gz \
minqa_1.2.4.tar.gz \
nloptr_1.0.4.tar.gz \
RcppEigen_0.3.2.4.0.tar.gz \
lme4_1.1-8.tar.gz
# more libraries Mine Cetinakya-Rundel asked for
RUN DEBIAN_FRONTEND=noninteractive wget \
http://mirrors.nics.utk.edu/cran/src/contrib/openintro_1.4.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/dplyr_0.4.2.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/assertthat_0.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/R6_2.0.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/magrittr_1.5.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/lazyeval_0.1.10.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/DBI_0.3.1.tar.gz \
http://mirrors.nics.utk.edu/cran/src/contrib/BH_1.58.0-1.tar.gz
RUN DEBIAN_FRONTEND=noninteractive R CMD INSTALL \
openintro_1.4.tar.gz \
assertthat_0.1.tar.gz \
R6_2.0.1.tar.gz \
magrittr_1.5.tar.gz \
lazyeval_0.1.10.tar.gz \
DBI_0.3.1.tar.gz \
BH_1.58.0-1.tar.gz \
dplyr_0.4.2.tar.gz
RUN rm \
openintro_1.4.tar.gz \
assertthat_0.1.tar.gz \
R6_2.0.1.tar.gz \
magrittr_1.5.tar.gz \
lazyeval_0.1.10.tar.gz \
DBI_0.3.1.tar.gz \
BH_1.58.0-1.tar.gz \
dplyr_0.4.2.tar.gz
# install rmarkdown
ADD ./conf /r-studio
RUN R CMD BATCH /r-studio/install-rmarkdown.R
RUN rm /install-rmarkdown.Rout
#Supervisord
# Supervisord
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor && \
mkdir -p /var/log/supervisor
CMD ["/usr/bin/supervisord", "-n"]
#SSHD
#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-server && \
# mkdir /var/run/sshd && \
# echo 'root:root' |chpasswd
# Config files
RUN cd /r-studio && \
cp supervisord-RStudio.conf /etc/supervisor/conf.d/supervisord-RStudio.conf
......@@ -149,13 +289,27 @@ RUN echo "" >> /etc/R/Rprofile.site && \
echo ".First <- function(){ library(downloader) }" >> /etc/R/Rprofile.site && \
echo "" >> /etc/R/Rprofile.site
# add a non-root user so we can log into R studio as that user
RUN (adduser --disabled-password --gecos "" guest && echo "guest:guest"|chpasswd)
# add a non-root user so we can log into R studio as that user; make sure that user is in the group "users"
RUN adduser --disabled-password --gecos "" --ingroup users guest
# add a script that supervisord uses to set the user's password based on an optional
# environmental variable ($USERPASS) passed in when the containers is instantiated
ADD initialize.sh /
# set the locale so RStudio doesn't complain about UTF-8
RUN locale-gen en_US en_US.UTF-8
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
#########
#
# if you need additional tools/libraries, add them here.
# also, note that we use supervisord to launch both the password
# initialize script and the RStudio server. If you want to run other processes
# add these to the supervisord.conf file
#
#########
EXPOSE 8787
CMD ["/usr/bin/supervisord"]
\ No newline at end of file
CMD ["/usr/bin/supervisord"]
The MIT License (MIT)
Copyright (c) 2014 Mark P. McCahill
Copyright (c) 2014-2015 Mark P. McCahill
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
RStudio in a Docker Container
=============================
What is this?
-------------
## What is this?
This project is an example of running RStudio from within a Docker container.
In addition to the basic RStudio server, the container also has the knitr and
Rmarkdown libraries so it is easy to create nicely formatted output. There is
also just enough of TeX to allow knitr to generate PDF output.
How to build
------------
## How to build
Build the container with the command:
Build the container with the command
```
sudo docker build -t="r-studio" .
```
Since the build file points directly at quite a few R extensions in the CRAN
repository, and since those extension are being updated, there is the distinct possibility
that the build file will complain about not being able fetch a specific library.
If this happens, look through the file list here: http://cran.r-project.org/src/contrib/
to find the new version of the library and update the Dockerfile.
## How to run
Run using the default password from the Dockerfile build script:
```
sudo docker run -d -p 0.0.0.0:8787:8787 -i -t r-studio
```
PROTIP: You will probably want to something more secure than an account
named guest with the password guest, so you will probably want to edit the
Dockerfile and fix that.
named guest with the password guest, so you will probably want pass in the
guest user password when you instance the container.
Since the build file points directly at quite a few R extensions in the CRAN
repository, and since those extension are being updated, there is the distinct possibility
that the build file will complain about not being able fetch a specific library.
If this happens, look through the file list here: http://cran.r-project.org/src/contrib/
to find the new version of the library and update the Dockerfile.
```
docker run -d -p 0.0.0.0:8787:8787 -e USERPASS=badpassword -i -t r-studio
```
You probably want the user's home directory to persist, so if the container restarts
the users' work is not blown away. To do this, map a home directory like this:
How to run
------------
docker run -d -e USERPASS=badpassword \
-v /external/directory/for/user:/home/guest \
-p 0.0.0.0:8787:8787 -i -t r-studio
## How to access
To access the app, point your web browser at
http://your.hostname.here:8787/
You will be prompted to login. Use the username 'guest' and the password 'guest'
You will be prompted to login. Use the username 'guest' and the password 'badpassword'
......@@ -3,4 +3,3 @@ r["CRAN"] <- "http://cran.r-project.org"
options(repos=r)
devtools::install_github('rstudio/rmarkdown')
[supervisord]
nodaemon=true
[program:initializestuff]
priority=5
directory=/
command=/bin/bash /initialize.sh
user=root
autostart=true
autorestart=false
startsecs=0
exitcodes=0
stdout_logfile=/var/log/initialize.log
stderr_logfile=/var/log/initialize.err
[program:rserver]
command=/usr/lib/rstudio-server/bin/rserver
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
#!/bin/bash
#
# We will almost certainly will mount an external volume to hold
# the 'guest' user directory (so that their work persists between
# container restarts). However, there is no guarantee that the
# container user owns or can write to that external volume, so
# make sure they own their home directory
#
chown -R guest ~guest ; chgrp -R users ~guest
#
# set the passwords for the user 'guest' based on environment variable.
#
if [ ! -z $USERPASS ]
then
/bin/echo "guest:$USERPASS" | /usr/sbin/chpasswd
unset USERPASS
fi
exit 0
sudo docker run -d -p 0.0.0.0:8787:8787 -i -t r-studio
docker run -d -p 0.0.0.0:8787:8787 -e USERPASS=badpassword -i -t r-studio
docker run -d -e USERPASS=badpassword \
-v /home/foobar/r-studio-in-docker/r-studio-homedirs/mccahill:/home/guest \
-p 0.0.0.0:8787:8787 -i -t r-studio
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment