Skip to content

legendu-net/docker-r-pop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R with popular packages in Docker. It is suggested that you use dclong/jupyterhub-ds for data science related work.

Detailed Information

OS: the latest Ubuntu 18.04
Desktop Environment: None
Remote Desktop: None
R

  • devtools roxygen2
  • Rcpp
  • rmarkdown DT caTools bitops
  • RJDBC jsonlite
  • data.table
  • mailR httr urltools openssl
  • ggplot2
  • lubridate

Usage in Linux/Unix

Prerequisites

You must have Docker installed. If you are on Ubuntu, the just use the command below to install the community edition of Docker.

sudo apt-get install docker.io

If you'd rather install the enterprise edition or if you are on other platforms, please refer to the offical Docker doc Install Docker.

Pull the Docker Image

docker pull dclong/r-pop

For people in mainland of China, please refer to the post Speedup Docker Pulling and Pushing on ways to speed up pushing/pulling of Docker images. If you don't bother, then just use the command below.

docker pull registry.docker-cn.com/dclong/r-pop

Start a Container

Below are some Docker command arguments explained. These are for properly handling file permissions in the Docker container and on the host. Keep the default if you don't know what are the best to use. DOCKER_PASSWORD is probably the only argument you want to and should change.

  • DOCKER_USER: The user to be created (dynamically) in the container. By default, the name of the current user on the host is used.
  • DOCKER_USER_ID: The ID of the user to be created in the container. By default, the ID of the current user on the host is used.
  • DOCKER_PASSWORD: The password of the user to be created. By default, it's the same as the user name. You'd better change it for security reasons. Of course, users can always change it later using the command passwd.
  • DOCKER_GROUP_ID: The group of the user to be created. By default, it's the group ID of the current user on the host.

The recommended working directory in the Docker container is /workdir. You can mount directory on the host to it as you wish.

The following command starts a container and mounts the current working directory and /home on the host machine to /workdir and /home_host in the container respectively.

docker run -d \
    --log-opt max-size=50m \
    -e DOCKER_USER=`id -un` \
    -e DOCKER_USER_ID=`id -u` \
    -e DOCKER_PASSWORD=`id -un` \
    -e DOCKER_GROUP_ID=`id -g` \
    -v `pwd`:/workdir \
    -v `dirname $HOME`:/home_host \
    dclong/r-pop

The following command (only work in Linux) does the same as the above one except that it limits the use of CPU and memory.

docker run -d \
    --log-opt max-size=50m \
    --memory=$(($(head -n 1 /proc/meminfo | awk '{print $2}') * 4 / 5))k \
    --cpus=$((`nproc` - 1)) \
    -e DOCKER_USER=`id -un` \
    -e DOCKER_USER_ID=`id -u` \
    -e DOCKER_PASSWORD=`id -un` \
    -e DOCKER_GROUP_ID=`id -g` \
    -v `pwd`:/workdir \
    -v `dirname $HOME`:/home_host \
    dclong/r-pop

Known Issues

  1. The subprocess managment issue. This is not an issue at in most use cases. This Docker image launch service using a shell script so there won't be orphan subprocesses when the process of the Docker container is get killed. However, launching by shell script is not the best way for managing processes. I might switch to the Supervisor for process management or use the base image of pushion/ubuntu in future.

About the Author

Personal Blog | GitHub | Bitbucket | LinkedIn

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published