R in Docker

使用docker 搭建R运行环境,并打通R与Java的通道

Short Description
r docker image from ubuntu:16.04 (r-base, r-base-dev, devtools, open-jdk8, rJava)
Full Description

Docker images for R, Shiny... from Ubuntu

  • r-min
    • Ubuntu:16.04
    • r-base and r-base-dev
  • r-basic
    • r-min
    • devtools (with dependencies = T)
    • (64 packages in site-library)
  • r-java
    • r-basic
    • open jdk 8
    • rJava
  • r-shiny

第一步:拉取镜像

docker pull jaehyeon/r-java

第二步:运行容器

docker run -d -p 81:81 -ti docker.io/jaehyeon/r-java:latest /bin/bash

第三步:进入R,安装rJava和Rserver

install.packages('rJava')

install.packages('Reserve')

第四步:配置环境变量

#add R env

R_HOME=/usr/lib/R
PATH=$PATH:$R_HOME/bin
LD_LIBRARY_PATH=/usr/local/lib/R/site-library/rJava/jri/

#add java

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin:$R_HOME/bin
export  LD_LIBRARY_PATH R_HOME  JAVA_HOME CLASSPATH  PATH

 

参考网址:https://hub.docker.com/r/jaehyeon/r-java/

 

你可能感兴趣的:(运维,java)