Giter Site home page Giter Site logo

shiny's Introduction

Docker for Shiny Server

This is a Dockerfile for Shiny Server on Debian stable. Dockerfiles building on specific versions of R are now available as tags. These images are based on the corresponding r-ver image. You can request a specific R version using the appropriate tag, e.g. rocker/shiny:3.3.2.

For documentation for R >= 4.0.0, for images r-ver, rstudio, tidyverse, verse, geospatial, shiny, and binder, please see the rocker-versioned2 repository`.

Usage:

To run a temporary container with Shiny Server:

docker run --rm -p 3838:3838 rocker/shiny

To get specific version of R with your shiny image (e.g. 3.4.4):

docker run --rm -p 3838:3838 rocker/shiny:3.4.4

Developer Notes

  • avoid apt-get install r-cran-* on this image stack. The requested R version and all R packages are installed from source in the version-stable stack. Installing R packages from apt (e.g. the r-cran-* packages) will install the version of R and versions of the packages that were built for the stable debian release (e.g. debian:stretch), giving you a second version of R and different packages. Please install R packages from source using the install.packages() R function (or the install2.r script), and use apt only to install necessary system libraries (e.g. libxml2). If you would prefer to install only the latest verions of packages from pre-built binaries using apt-get, consider using the r-base stack instead. See rocker-versioned README for details on extending these images.

shiny-verse

You can use rocker/shiny-verse image stack instead if you'd like tidyverse packages pre-installed on your instance of shiny.

Connecting app and log directories to host

To expose a directory on the host to the container, use -v <host_dir>:<container_dir>. The following command will use one /srv/shinyapps as the Shiny app directory and /srv/shinylog as the directory for Shiny app logs. Note that if the directories on the host don't already exist, they will be created automatically.:

docker run --rm -p 3838:3838 \
    -v /srv/shinyapps/:/srv/shiny-server/ \
    -v /srv/shinylog/:/var/log/shiny-server/ \
    rocker/shiny

If you have an app in /srv/shinyapps/appdir, you can run the app by visiting http://localhost:3838/appdir/. (If using boot2docker, visit http://192.168.59.103:3838/appdir/)

In a real deployment scenario, you will probably want to run the container in detached mode (-d) and listening on the host's port 80 (-p 80:3838):

docker run -d -p 80:3838 \
    -v /srv/shinyapps/:/srv/shiny-server/ \
    -v /srv/shinylog/:/var/log/shiny-server/ \
    rocker/shiny

Warnings

In the logs, you may see a note that shiny is running as root. To run as a regular user, simply set the user in your Docker run command, e.g.

docker run --user shiny -p 3838:3838 --rm rocker/shiny

Logs

The Shiny Server log and all application logs are written to stdout and can be viewed using docker logs.

The logs for individual apps are still kept in the /var/log/shiny-server directory, as described in the Shiny Server Administrator's Guide. If you want to avoid printing the logs to STDOUT, set up the environment variable APPLICATION_LOGS_TO_STDOUT to false (-e APPLICATION_LOGS_TO_STDOUT=false).

With docker-compose

This repository includes an example docker-compose file, to facilitate using this container within docker networks.

To run a container with Shiny Server:

docker-compose up

Then visit http://localhost (i.e., http://localhost:80) in a web browser. If you have an app in /srv/shinyapps/appdir, you can run the app by visiting http://localhost/appdir/.

To add a Shiny app:

  1. Uncomment the last line of docker-compose.yml.
  2. Place the app in mountpoints/apps/the-name-of-the-app, replacing the-name-of-the-app with your app's name.

If you have an app in mountpoints/apps/appdir, you can run the app by visiting http://localhost/appdir/. (If using boot2docker, visit http://192.168.59.103:3838/appdir/)

Logs

The example docker-compose file will create a persistent volume for server logs, so that log data will persist across instances where the container is running. To access these logs, while the container is running, run docker exec -it shiny bash and then ls /var/log/shiny-server to see the available logs. To copy these logs to the host system for inspection, while the container is running, you can use, for example, docker cp shiny:/var/log/shiny-server ./logs_for_inspection.

Detached mode

In a real deployment scenario, you will probably want to run the container in detached mode (-d):

docker-compose up -d

Custom configuration

To add a custom configuration file, assuming the custom file is called shiny-customized.config, uncomment the line

COPY shiny-customized.config /etc/shiny-server/shiny-server.conf

in the Dockerfile, and then run docker-compose build shiny to rebuild the container. Inline comments above that line in the Dockerfile provide additional documentation.

Trademarks

Shiny and Shiny Server are registered trademarks of RStudio, Inc. The use of the trademarked terms Shiny and Shiny Server and the distribution of the Shiny Server through the images hosted on hub.docker.com has been granted by explicit permission of RStudio. Please review RStudio's trademark use policy and address inquiries about further distribution or other questions to [email protected].

shiny's People

Contributors

cboettig avatar cderv avatar dlebauer avatar eddelbuettel avatar edwinth avatar matthieubizien avatar noamross avatar rvernica avatar smnbbrv avatar wch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shiny's Issues

Error Building Dockerfile 3.5.2

I am getting the following error when trying to build shiny-verse Dockerfile 3.5.2 Dockerfile

The downloaded source packages are in
‘/tmp/downloaded_packages’
Error: installation of package ‘sf’ had non-zero exit status
In addition: Warning messages:
1: In install.packages(pkgs, ...) :
installation of package ‘units’ had non-zero exit status
2: In install.packages(pkgs, ...) :
installation of package ‘rgdal’ had non-zero exit status
3: In install.packages(pkgs, ...) :
installation of package ‘rgeos’ had non-zero exit status
4: In install.packages(pkgs, ...) :

Question install package

when I restart docker image, all R package is gone which I installed before. Do I need to specify all the package at Dockerfile?

apt-get update' returned a non-zero code: 100

I had working containers derived from rocker/shiny before, but recently I always run into an error. The simplest Dockerfile to reproduce:

FROM rocker/shiny:latest

MAINTAINER Dieter Menne "[email protected]"

RUN apt-get update 
Get:36 http://ftp.uni-stuttgart.de/debian sid/main amd64 Packages.diff/Index [27.9 kB]
Get:36 http://ftp.uni-stuttgart.de/debian sid/main amd64 Packages.diff/Index [27.9 kB]
Get:37 http://ftp.uni-stuttgart.de/debian sid/main amd64 Packages [9,795 kB]
Reading package lists...
E: Could not open file /var/lib/apt/lists/http.debian.net_debian_dists_sid_main_binary-amd64_Packages.diff_Index - open (2: No such file or directory)
The command '/bin/sh -c apt-get update' returned a non-zero code: 100

exec user process caused "no such file or directory" when using `...Add=shiny...`

With this docker file:

FROM rocker/verse:3.5.1

MAINTAINER Steven H. Ranney

RUN export ADD=shiny && bash /etc/cont-init.d/add

RUN R -e "install.packages(c('shiny', 'googleAuthR', 'dplyr', 'googleAnalyticsR', 'knitr', 'rmarkdown', 'jsonlite', 'scales', 'ggplot2', 'reshape2', 'Cairo', 'tinytex'), repos = 'https://cran.rstudio.com/')"

#Copy app dir and theme dirs to their respective locations
COPY app /srv/shiny-server/
COPY app/report/themes/SwCustom /opt/TinyTeX/texmf-dist/tex/latex/beamer/

#Force texlive to find my custom beamer thems

RUN texhash

EXPOSE 3838

COPY shiny-server.sh /usr/bin/shiny-server.sh

COPY shiny-customized.config /etc/shiny-server/shiny-server.conf

CMD ["/usr/bin/shiny-server.sh"]

docker build -t <tag> . is successful. When I docker run --rm -p 3838:3838 <tag>, I get the following error:

C:\Users\sranney\Repositories\dockerTest>docker run --rm -p 3838:3838 ranney/shinydocs:0.0.1
standard_init_linux.go:190: exec user process caused "no such file or directory"

I don't understand from where this error is coming, however. The build doesn't seem to throw any errors; however, when I scroll up to find anything that could be incriminating, I see

docker_error

that suggests that a shiny user can't be created.

Is this what's causing the run error when I try to launch this container? If not, what else could it be?

Latest build (today) gives R openssl build error

Seems libssl-dev is not installed in the latest debian build you use?
Thanks for your excellent work - Nathan

* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: [email protected] (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/usr/local/lib/R/site-library/openssl’

rocker/shiny not using the latest version of R (using 3.4.1 not 3.4.3)

$ docker run -it rocker/shiny bash
root@a82b8c87281f:/# R

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
...

whilst:

$ docker run -it r-base bash
root@bdb52ac17364:/# R

R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
...

I don't understand why this is - as far as I can tell rocker/shiny should be pulling the latest r-base version (and a build was ran not long ago)?

Minor build issue:

During build there is a message:

delaying package configuration, since apt-utils is not installed

Seem to have no detrimental effect, though.

Can't start Shiny apps

I appologise for x-post from SO: https://stackoverflow.com/questions/54587644/rocker-shiny-not-seeing-apps-after-reboot If I should delete/close one of the questions please let me know.

I'm not being able to start shiny apps from rocker/shiny on windows any more after recent reboot of host; while my setup steps are still identicall.

This is how I start the image:

docker run -d -p 80:3838 -v D:/Projects/DockedShiny/apps/:/srv/shiny-server/ -v D:/Projects/DockedShiny/logs:/var/log/shiny-server/ rocker/shiny

I can see shiny was started:

C:\Users\Honza>docker logs gallant_thompson

*** warning - no files are being watched ***
[2019-02-08T06:49:04.860] [INFO] shiny-server - Shiny Server v1.5.9.1 (Node.js v8.11.3)
[2019-02-08T06:49:04.887] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2019-02-08T06:49:04.927] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2019-02-08T06:49:04.931] [INFO] shiny-server - Starting listener on http://[::]:3838

By inspecting the configuration I can see it's configured to files and folders that I specified during image startup:

root@778e307632ab:/etc/shiny-server# more shiny-server.conf
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

Despite this the shiny web directory listing is empty (displays just Index of/ and nothing else) and when specifying app by name (e.g. http://localhost/myapp) I'm getting Page not found. There is no new logs in Shiny log location.

The exact same scenario worked just fine for months. I recently needed to reboot my host machine and now I cannot make shiny to recognize my apps.

I tried to run under user shiny and with specific version, but with no change:

docker run --user shiny -d -p 80:3838 -v D:/Projects/DockedShiny/apps/:/srv/shiny-server/ -v D:/Projects/DockedShiny/logs:/var/log/shiny-server/ rocker/shiny:3.5.1

Anybody has any suggestions what should I try or investigate next?
What exactly does the warning - no files are being watched in stdout mean?

Shiny does not appear to work with Alpine Linux

I am running the latest version of docker using Alpine Linux 3.6 and I can pull the shiny docker file.

However, when I try to run Shiny via docker run --rm -p 3838:3838 rocker/shiny the process does not run. I can verify this via docker ps and by pointing my browser to my ip_addr:3838.

I also tried adding Shiny to the rocker/rstudio docker file via docker run -d -p 3838:3838 -p 8787:8787 -e ADD=shiny rocker/rstudio and in this case I can access RStudio at port 8787 but I still don't see the Shiny server at port 3838.

Stuck with package '<package name>' was installed by an R version with different internals...

Hey, I know this issue was already brought up and closed, but I am really stuck here. We were using an shiny server based on rocker/shiny + some extra stuff/packages. Since yesterday I tried to rebuild the whole image, but I keep getting these errors in the building process and all my apps crash because the packages are missing:

Error : package ‘<package name>’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version

My docker file starts like this:

FROM rocker/shiny

RUN rm /srv/shiny-server/index.html && \
	rm -rf /srv/shiny-server/sample-apps && \
	apt-get update && \	
	apt-get install -y python python-pip && \
        pip install awscli && \
	apt-get install -y libudunits2-dev && \
	apt-get install -y r-cran-rjava && \
	apt-get install -y libcurl4-openssl-dev && \
	apt-get install -y libssl-dev && \
	apt-get install -y libgdal-dev && \
	apt-get install -y libxml2-dev && \
	apt-get install -y libjq-dev && \
	R -e "install.packages('devtools', repos = 'http://cran.rstudio.com/')" && \
	R -e "devtools::install_github('cloudyr/aws.ec2metadata')" && \
	R -e "devtools::install_github('cloudyr/aws.signature')" && \ 
        ....

Everything used to work fine before. Am I doing something wrong? Did anything change?

Updating /etc/shiny-server/shiny-server.conf

How does one go about updating shiny-server.conf, I've tried to call just about every incantation of "restart" that I could. If I up/down the docker container it just restarts from default shiny-server.conf?

All I'd really like to do is turn off the directory listing. Are there some magic debian specific commands that I should be using?

Using a specific R version

Dear developers,

for a production-ready shiny app we need to settle the R version to a specific number to freeze all dependencies and packages.
Is there a way to do this with your shiny docker image? It seems I can only use the

:latest

tag which implicitly fetches the latest R-base version which is not what we want to have.

You currently don't have any tagging mechanism in the Dockerfile? Is there any way how I can do this easily?

Thank you for your help
Oliver

Cannot access env variables from the executed app

Let's suppose the following dockerfile. The app.R is then inside /srv/shiny-server

FROM rocker/shiny

RUN apt-get update && apt-get upgrade -y && apt-get install -y libv8-dev libssl-dev

RUN R -e "install.packages(c('shinydashboard', 'DT', 'shinyWidgets', 'shinyFiles', 'diffobj', 'shinyjqui', 'shinyjs', 'V8', 'RSQLite', 'DBI', 'generator', 'dplyr', 'randNames'))"

RUN rm -rf /srv/shiny-server/*
COPY . /srv/shiny-server/

EXPOSE 3838
CMD ["/usr/bin/shiny-server.sh"]

I am using ShinyProxy to initialize the container. It passes the env variable SHINYPROXY_USERNAME to the root user. But somehow the app can't read it, so the app doesn't know who's the person logged in.

Inside the app.R I've put the following JS alert:
alert(system("whoami"))

And it outputs just "0". That's not even a user. So how can that user have access to the environmental variables of "root"? Something needs to be done! Is really "0" the user running the app? I doubt so

Do you know how can I get rid of this problem, so the app can know the user logged in? Thanks

EDIT: This comes from https://support.openanalytics.eu/t/shinyproxy-username-in-shiny-user/1038

tidyverse missing

When I start a docker container with docker run -it rocker/shiny-verse bash

open R and type library(tidyverse)

I get Error in library(tidyverse) : there is no package called ‘tidyverse’

(same with dplyr).

How can I use tidyverse inside this container?

rmarkdown::render freezes because pandoc freezes when LC_ALL and LANG are unset

Recently I have noticed thath rmarkdown::render fails in your container because pandoc freezes if one have LC_ALL and LAND unset. So if someone has a shiny app with a button that generates simple rmarkdown reports like this app (http://shiny.rstudio.com/articles/generating-reports.html) then he'll have serious diagnostics problems as report will not be rendered and pandoc will freeze for eternity.

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
95139ad68706        rocker/shiny        "/usr/bin/shiny-serve"   9 minutes ago       Up 9 minutes        0.0.0.0:3838->3838/tcp   small_leavitt
mkosinski@mkosinski-E540:~$ docker exec -it 95139ad68706 /bin/bash
root@95139ad68706:/# /opt/shiny-server/ext/pandoc/pandoc                                                                                                                                                                              
^C
root@95139ad68706:/# /opt/shiny-server/ext/pandoc/pandoc --version 
pandoc 1.12.3
Compiled with texmath 0.6.6, highlighting-kate 0.5.6.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc,
    javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell,
    lua, makefile, mandoc, markdown, matlab, maxima, metafont, mips, modelines,
    modula2, modula3, monobasic, nasm, noweb, objectivec, objectivecpp, ocaml,
    octave, pascal, perl, php, pike, postscript, prolog, python, r,
    relaxngcompact, restructuredtext, rhtml, roff, ruby, rust, scala, scheme,
    sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog, vhdl,
    xml, xorg, xslt, xul, yacc, yaml
Default user data directory: /root/.pandoc
Copyright (C) 2006-2013 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.
root@95139ad68706:/# unset LANG
root@95139ad68706:/# /opt/shiny-server/ext/pandoc/pandoc --version
pandoc 1.12.3
Compiled with texmath 0.6.6, highlighting-kate 0.5.6.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc,
    javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell,
    lua, makefile, mandoc, markdown, matlab, maxima, metafont, mips, modelines,
    modula2, modula3, monobasic, nasm, noweb, objectivec, objectivecpp, ocaml,
    octave, pascal, perl, php, pike, postscript, prolog, python, r,
    relaxngcompact, restructuredtext, rhtml, roff, ruby, rust, scala, scheme,
    sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog, vhdl,
    xml, xorg, xslt, xul, yacc, yaml
Default user data directory: /root/.pandoc
Copyright (C) 2006-2013 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.
root@95139ad68706:/# unset LC_ALL                                 
root@95139ad68706:/# /opt/shiny-server/ext/pandoc/pandoc --version

This command never stops. What is more, docker start using maximum available RAM for him.

LC_ALL is unset without user's knowledge in rmarkdown https://github.com/rstudio/rmarkdown/blob/master/R/pandoc.R#L601, so it is very easy to have problems with LANG and to freeze docker with no meaningful error message.

Do you think this is the case of your docker or I rather submit this discovery to rstudio/rmarkdown. In my opinion the solution is : pandoc should close after a while with message cant run when LC_ALL and LANG global env are unset` or something like this.

Start command for docker: docker run --rm -p 3838:3838 rocker/shiny

Install required packages when creating container

Is it possible to install required package at the moment of creating a container from rocker/shiny image? For example, I have a Shiny application that depends on DT package. The shiny-server.sh script would search for R files (passed by -v argument) in a specific folder and run those file.

Shiny-verse does not render RMarkdown

Hello! I tried to run shiny-verse container but it does not render demo RMarkdown application:
image.

Looks like the problem is in missing JS files, see 404 HTTP responses):
image

The docker image info and container logs are:

$ docker image ls rocker/shiny-verse:latest
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
rocker/shiny-verse   latest              0052bf0992e2        23 hours ago        1.86GB

$ docker container run --rm -it -p 3838:3838 rocker/shiny-verse:latest

*** warning - no files are being watched ***
[2019-04-21T12:01:09.630] [INFO] shiny-server - Shiny Server v1.5.11.924 (Node.js v8.11.3)
[2019-04-21T12:01:09.636] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2019-04-21T12:01:09.796] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2019-04-21T12:01:09.805] [INFO] shiny-server - Starting listener on http://[::]:3838
[2019-04-21T12:01:13.470] [INFO] shiny-server - Created bookmark state directory: /var/lib/shiny-server/bookmarks
[2019-04-21T12:01:13.476] [INFO] shiny-server - Created user bookmark state directory: /var/lib/shiny-server/bookmarks/shiny

*** '/var/log/shiny-server//rmd-shiny-20190421-120113-39745.log' has been created ***

*** /var/log/shiny-server//rmd-shiny-20190421-120113-39745.log ***

Listening on http://127.0.0.1:39745



processing file: index.Rmd
output file: /tmp/RtmpclJleh/index.knit.md


Output created: /tmp/RtmpclJleh/file13770584f4.html

However, when I built shiny-verse image myself from source (https://github.com/rocker-org/shiny/blob/master/shiny-verse/Dockerfile) it works without problem.

shiny usernid in rocker/shiny container

For now when you runs the rocker/shiny container the defualt shiny username is 999

mkosinski@mkosinski-E540:~$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
427e5f014087        rocker/shiny        "/usr/bin/shiny-serve"   5 minutes ago       Up 5 minutes        0.0.0.0:3838->3838/tcp   naughty_ptolemy
mkosinski@mkosinski-E540:~$ docker exec -it naughty_ptolemy /bin/bash
root@427e5f014087:/# id -u shiny                                                                                                                                 
999

Is there a way to create this user with different id, other than creating this user manually at the beggining of Dockerfile like this

RUN useradd -d home_path -g group_name -u 333 shiny

Sometimes to allow communication with VOLUMES the shiny userid has to be the same as the shiny userid of user that created those folders on a machine on which docker is running.

libcairo2-dev

When trying to build from source, I got the following unresolved dependency:

The following packages have unmet dependencies:
libcairo2-dev : Depends: libfontconfig1-dev (>= 2.2.95) but it is not going to be installed
Depends: libfreetype6-dev (>= 2.1.10) but it is not going to be installed

Volume permission issue

I'm currently using this Docker image to deploy Shiny Apps. I ran into an issue where I needed to mount a volume from the host machine to the Docker container. Since the Shiny server in the container runs each Shiny app using the user 'shiny', who has no access to these mounted volumes. I checked the rstudio docker repo about how to start docker using a different user(Uid), but even if I start the docker container using user 'shiny', it doesn't help.

I'm mounting the volumes because these files are rather large and users want to use Shiny app without uploading them, or even just some large files shared by all users(don't want to put the files in the docker container).

Currently, I just want to be able to read the files. It seems writing files to the host volumes would be more difficult.

Thanks!

"Version of R with different internals"

When I pulled the latest version of this into my own Dockerfile and tried to install some packages, it told me that I need to reinstall some packages like Rcpp and digest.

On inspection, it seems that there might be some kind of version mismatch - r-base was last pushed a month ago while this was last pushed 3 months ago, which may have something to do with it.

I don't totally understand how docker works, so I'm not sure that made sense, but I decided to build my own image, based on rocker/r-ver:latest instead of r-base:latest, and basically copied most of the rest of this (minus the 'unstable' things and adding wget into the apt-get) into my own Dockerfile before the other libraries I need. That seems to have worked.

Maybe shiny should be added to the versioned stack (either before or after rstudio)?

HTTP server error on Kubernetes

Hello again,

I successfully create and run a docker container locally and access my Shiny App with localhost:3838 in a web browser.

However, when I deploy the same docker image to Kubernetes, I get the following error:

*** warning - no files are being watched ***
[2019-01-25T14:09:45.545] [INFO] shiny-server - Shiny Server v1.5.9.1 (Node.js v8.11.3)
[2019-01-25T14:09:45.548] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2019-01-25T14:09:45.612] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2019-01-25T14:09:45.618] [INFO] shiny-server - Starting listener on http://[::]:3838
[2019-01-25T14:09:45.627] [ERROR] shiny-server - HTTP server error (http://[::]:3838): listen EAFNOSUPPORT :::3838
[2019-01-25T14:09:45.627] [INFO] shiny-server - Shutting down worker processes 

This is my shiny-server.conf file:

run_as shiny;
server {
  listen 3838;

  location / {
    site_dir /srv/shiny-server;
    log_dir /var/log/shiny-server;
    directory_index on;
  }
}

Any help is appreciated!

Please tag releases so Docker images have version numbers

Could the project please tag version releases occasionally, so that Docker hub has versioned tags, so we can reliably build downstream containers against the known version?

Right now with no release tags, there is only one version at Docker hub tagged 'latest'. This means that

  • when a breaking change or bug is introduced, downstream container builds fail
  • when a bug is fixed, downstream containers builds still fail because cached the bad container

Cannot install latest shiny-server

I cannot install due to any issues with the shiny-server.dev

Please see my error message below

 RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" &&     VERSION=$(cat version.txt)  &&     wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb &&     gdebi ss-latest.deb &&     rm -f version.txt ss-latest.deb
 ---> Running in 0400e1eac43b
2018-07-05 09:00:30 URL:https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION [10/10] -> "version.txt" [1]
2018-07-05 09:01:06 URL:https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-1.5.7.890-amd64.deb [63350254/63350254] -> "ss-latest.deb" [1]
Reading package lists... Done
Error opening the cache:
E:The value 'testing' is invalid for APT::Default-Release as such a release is not available in the sources
The command '/bin/sh -c wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" &&     VERSION=$(cat version.txt)  &&     wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb &&     gdebi ss-latest.deb &&     rm -f version.txt ss-latest.deb' returned a non-zero code: 

docker build fails

docker build --no-cache=true -t x/testbuild . fails with this error

The following packages have unmet dependencies:
 pandoc : Depends: pandoc-data (= 1.17.0.3~dfsg-1+b1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get update && apt-get install -y -t unstable     sudo     gdebi-core     pandoc     pandoc-citeproc     libcurl4-gnutls-dev     libcairo2-dev/unstable     libxt-dev' returned a non-zero code: 100

However, when using the cache it doesn't fail. I'm currently looking into it further. Maybe someone has already run into this problem and can help solve it.

Chinese characters in R plots can't display properly.

While hosting a Shiny App using r-base image, the Chinese characters in plots can't display properly, but in code line comments they are just fine.

I thought this might caused by the locale settings, And tried to set it to zh_CN. But it doesn't work neither.

图片

To reproduce this kind of problem conveniently, run this command in r-base :

plot(1, main="标题")

License file not present

I was just looking for a License file for Rocker's projects in general, and this project specifically, and did not find one. To confirm, are the files in this repo. under a particular license? If not, are you open to attaching a license file to them?

Thank you for your work on this!

Corrupt/Missing /var/lib/apt/lists/?

There seems to be an issue with cached lists in /var/lib/apt/lists/.
apt-get update throws the error:

E: Could not open file /var/lib/apt/lists/http.debian.net_debian_dists_sid_main_binary-amd64_Packages.diff_Index - open (2: No such file or directory)

Updating this folder (e.g. mv /var/lib/apt/lists/ /var/lib/apt/lists_bac/ and apt-get update) solves this.

application logs should be written to the stdout

Hi guys,

Intro

it's quite a common behavior that all the docker logs are written to STDOUT / STDERR.

https://docs.docker.com/config/containers/logging/

Problem

That's sad but (due to whatever reason) shiny server and shiny application logs are considered to be different. This is fine unless we talk about the docker.

As a developer / devops / administrator I'm way more interested in the applications' rather than shiny-server's logs. In other words, I don't care about shiny server itself, I do care about my application. I want to know when it gets down and, more important, WHY it gets down in a production environment. Shiny-server itself does everything to prevent me from getting this information. The logs are automatically deleted after application fails (but at least I can stop this by a proper setting). Still, there is no option to put application logs to STDOUT / STDERR. The log filenames are always different.

This goes against any logic, it is not production- / cloud-friendly. I cannot use standard tools for collecting the logs and this is painful, e.g. see https://kubernetes.io/docs/concepts/cluster-administration/logging/.

Workarounds

I think mounting a volume is not a good way of getting the logs. First of all, they (again) automatically get deleted. Secondly, this is probably fine for development purposes but for production... It's generally impossible to support this without additional effort and tools.

Proposal

I would be totally satisfied to see all the logs in one thread. If this is not a default behavior - fine, let's enable this with some environment variable.

I found a solution for this and posted it as a pull request #43 . This solution is additionally good because you can always see the filename before the logs => you can easily find which application did log that. The solution is bad because it makes a roundtrip, using the filesystem watcher to see the file changes. Generally, this far away from the best solution, but it is absolutely better than nothing.

Actually I don't see any problem with not merging the PR. It's always enough to extend the Dockerfile with the command from the PR. I simply want other suffering people to find a way around this problem.

Please let me know what you think.

Add Docker tags for versioning shiny

Hi,
I would like to use this image in a production environment, but for that I need version tags so I can create reproducible and stable installations of RStudio and Shiny. Here is what I would propose:

  • Remove the automatic version file download from S3
  • Add a "version.txt" file to the repo with the same format as the one from S3
  • Add a simple shell script which:
    • Takes and option argument for the version
    • If not passed it downloads the version file from S3
    • If passed it writes the passed argument to the "version.txt" file
    • Does a git commit and git tag with the version from the file
    • Pushes everything to github

That way Docker builds can easily be tagged with versions and "releasing" a new version is not more than running a single script from time to time. Plus the versions can also be managed by pull requests if that is the preferred workflow.
I will of course prepare a pull request for these changes if they are ok for you.

regards,
Jörg

Error in loadNamespace(name) : there is no package called ‘devtools’ Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execution halted

Hi,

I am trying to build a docker contained for a shiny app. I need to include the following packages: readr and rdrop2. I have managed to compile the image with rocker/tidyverse using the following code:

FROM rocker/tidyverse:latest
RUN R -e "devtools::install_github('karthik/rdrop2') "
EXPOSE 3838

The problem is I don't want to user rocker/tidyverse (I don't need RStudio). However, I cannot build the container using rocker/shiny. I tried to install the packages from CRAN, from devetools, but it doesn't help. My docker file is:

FROM rocker/shiny:latest

RUN R -e "install.packages('devtools')"
RUN R -e "install.packages('readr')"
RUN R -e "devtools::install_github('karthik/rdrop2')"

EXPOSE 3838

devtools installation seems to be successful (when I re-run the script docker uses the cache for that part), but then I get the error: Error in loadNamespace(name) : there is no package called ‘devtools’
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted
. I would appreciate some advice on how to solve this problem.

32-bit version

I am working with the rocker/shiny-verse image and would like to connect to an Oracle DB with the RODBC package. This currently works only with the 32-bit version of R. Is there a way to open 32-bit R or would you consider adding it?

boost?

We're getting some issues around building with dependencies that require boost. More then this. Similarly we're trying to figure out which dependencies might be missing. This is on 3.5.1 or latest. Will be trying 3.4.4 to see if there's a 3.4 vs 3.5 issue.

g++  -I"/usr/local/lib/R/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -DRCPP_USING_UTF8_ERROR_STRING -I"/usr/local/lib/R/site-library/BH/include" -I"/usr/local/lib/R/site-library/bindrcpp/include" -I"/usr/local/lib/R/site-library/plogr/include" -I"/usr/local/lib/R/site-library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
In file included from /usr/local/lib/R/site-library/BH/include/boost/smart_ptr/shared_ptr.hpp:28:0,
                 from /usr/local/lib/R/site-library/BH/include/boost/shared_ptr.hpp:17,
                 from ../inst/include/dplyr/MultipleVectorVisitors.h:4,
                 from ../inst/include/dplyr/dplyr.h:16,
                 from ../inst/include/dplyr.h:8,
                 from RcppExports.cpp:4:
/usr/local/lib/R/site-library/BH/include/boost/smart_ptr/detail/shared_count.hpp:355:33: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
     explicit shared_count( std::auto_ptr<Y> & r ): pi_( new sp_counted_impl_p<Y>( r.get() ) )

Labels for R version, CRAN mirror and shiny version

Often I need to check some info of Docker image before pulling it from DockerHub. There is API and tools for that, see https://github.com/containers/skopeo and https://hackernoon.com/inspecting-docker-images-without-pulling-them-4de53d34a604 .

It would be nice to have LABELs for versions of packages the rocker/shiny images (especially :devel and :latest) were built with.

The most interesting labels for me are:

  • R version
  • URL of CRAN stored in /usr/local/lib/R/etc/Renviron
  • URL of MRAN snapshot stored in /etc/environment
  • version of shiny package.
    Perhaps the first three should be set in the rocker/r-ver Dockerfile.

If it sounds reasonable, I could prepare a patch.

can't start Shiny app as user shiny

When I ran docker run --user shiny -p 3838:3838 rocker/shiny:3.5.1, I was able to see the Welcome to Shiny Server! page come up, but instead of seeing the It's Alive message on the right, I got An error has occurred. The application failed to start. The application exited during initialization.

The stdout log showed the following errors:
[2018-10-04T00:48:25.513] [ERROR] shiny-server - Bookmark state directory creation failed: /var/lib/shiny-server/bookmarks
[2018-10-04T00:48:25.515] [WARN] shiny-server - ENOENT: no such file or directory, stat '/var/lib/shiny-server/bookmarks'
[2018-10-04T00:48:25.516] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.```

It seems that the user shiny doesn't have permission to create the directory /var/lib/shiny-server/bookmarks since /var/lib/shiny-server is owned by root. I see that in the Dockerfile the shiny user is given ownership of /var/log/shiny-server: https://github.com/rocker-org/shiny/blob/master/3.5.1/shiny-server.sh#L4-L5 Should the same be done for the /var/lib/shiny-server directory? Or does anyone have suggestions on how to get the existing image to work without running as root?

exec: \"/usr/bin/shiny-server.sh\": permission denied

When building the image with the current Dockerfile and subsequently starting a container I get the above message. I have fixed this myself by adding

RUN ["chmod", "+x", "/usr/bin/shiny-server.sh"]

to the Dockerfile. I am not sure if this problem is specific to me, but I just wanted to notify you guys.

Restart server

I'm trying to put the server behind a nginx authentication and I can't seem to get the server to respond to system stop shiny-server. Any idea how to stop and start the server?

supplied version of libssl

First of all, great work! Many thanks for providing this
A question rather than an issue:
Why did you add libssl 0.9.8? What is it for?
I am asking because I ended up having libssl1.0.0 (1.0.2d-1) and libssl0.9.8 and when some R package required a dev package of libssl I installed libssl-dev (1.0.2d-1). Is this okay or libssl0.9.8 -dev is required? Thanks!

Rcppeigen

We're having issues figuring out a way to get RcppEigen to install properly. It's a dependency in one of our packages.

So far we've added the following, as well as adjusting memory settings, with no luck. Any suggestions? I'm about to try going back to 3.4.4 to see if it's a 3.5 vs 3.4 issue.

RUN apt-get update -y
RUN apt-get upgrade -y

RUN export DEBIAN_FRONTEND=noninteractive
# Installing packages required for requirements.R
RUN apt-get install -y cron git libssl-dev libnlopt-dev libgit2-dev libssh2-1-dev liblapack-dev libeigen3-dev libblas-dev libomp-dev build-essential libigraph0-dev libboost-atomic-dev libopenblas-dev libatlas-base-dev gfortran libxml2-dev

Chinese character support

Dear maintainers,

Thanks for your work of this shiny docker image. However, I found that it fails to render Chinese character correctly.

After changing some locale setting, I resolve this issue. The details is in: https://github.com/wush978/tw-r-shiny. I switch the default locale from C to en_US.UTF-8 and install the required fonts.

Could I send a PR to resolve this issue according to my previous modification?

Best,
Wush

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.