Starting container process caused \"exec: \\\"R\\\": executable file not found in $PATH\": unknown"}

I installed shinyproxy using docker-compose.

When going to my shiny app, I am running into the error:

Status code: 500
Message: Failed to start container

and when checking into error message I see:

starting container process caused “exec: \“R\”: executable file not found in $PATH”: unknown"}

I am not sure to understand what it means.
In case that helps, the last lines of my Shiny Dockerfile are:

EXPOSE 3838
CMD ["R", "-e", "shiny::runApp('/root/app')"]

and in my application.yml the container-cmd line is
container-cmd: ["R", "-e", "shiny::runApp('/root/app')"]

Do you see any wrong spelling?
Also as an FYI but don’t know if that’s useful information, I noticed there is no R folder in my folder: /usr/lib
Thanks for your help !

These suggest you might have issues with your R installation. What docker image did you use? Can you try to launch your application from a container outside shinyproxy, as desribed in https://www.shinyproxy.io/troubleshooting/ ?

Thanks for your reply :slight_smile:

I just ran: sudo docker run -p 3838:3838 openanalytics/shinyproxy-demo R -e 'shinyproxy::run_01_hello()' and it works perfectly well, so don’t know what could be the issue.

Do you know how can I check if R was correctly installed with docker?

I am attaching below the Dockerfile for my RStudio container and the Dockerfile for Shiny container:

RStudio Dockerfile:

FROM rocker/tidyverse:3.6.1

## Create directories
RUN mkdir -p /rstudio
RUN mkdir -p /rscripts

RUN R -e "install.packages(c('rvest','shiny','DT', 'digest', 'RCurl', 'caTools', 'bitops', 'httr', 'curl', 'stringr', 'mailR', 'xlsx', 'knitr', 'kableExtra' ,'rmarkdown', 'data.table', 'RSelenium'), repos = 'http://cran.us.r-project.org')"

Shiny Dockerfile:

FROM rocker/shiny:3.5.1

RUN apt-get update && apt-get install libcurl4-openssl-dev libv8-3.14-dev -y &&\
    mkdir -p /var/lib/shiny-server/bookmarks/shiny &&\
    mkdir -p /root/app

# Download and install library
RUN R -e "install.packages(c('mailR', 'shinydashboard', 'shinyjs', 'V8', 'DT', 'shiny', 'rvest', 'dplyr', 'htmltools', 'promises', 'jsonlite', 'data.table', 'rlang', 'xml2', 'digest', 'XML','rmarkdown'))"

# copy the app to the image
COPY app /root/app
COPY Rprofile.site /usr/local/lib/R/etc

# make all app files readable (solves issue when dev in Windows, but building in Ubuntu)
RUN chmod -R 755 /root/app
RUN chmod -R 755 /usr/local/lib/R/etc

EXPOSE 3838

CMD ["R", "-e", "shiny::runApp('/root/app')"]

@mnazarov would you have any other idea how I could tackle this issue? I have to admit I am quite desperate so far with no clue how to progress…

Have you tried my first idea? I mean running the app ‘manually’ from the dockerfile with:

sudo docker run -p 3838:3838 whateveristhenameofyourshinyimage R -e "shiny::runApp('/root/app')"

You can also run terminal (bash) inside the image to inspect where R is installed, or what is your PATH variable etc:

sudo docker run -it whateveristhenameofyourshinyimage bash

Also note that you don’t need shiny-server in your docker image, you just need the shiny R package (see https://www.shinyproxy.io/deploying-apps/ and other topics in this forum)

hi @mnazarov thanks a lot for your reply.

I managed to make it work thanks to the link you shared. I had seen it but reading it again made me realize I was doing things incorrectly.

The confusion I had was that I am using docker-compose to launch multiple containers and 3 of them are rstudio, shiny and shinyproxy. rstudio for my analysis and scripts, shinyproxy and then shiny to develop my dashboard in “test” environment.

What I shared above is the shiny Dockerfile but I never shared my shinyproxy Dockerfile, and this is the one that was incorrect.
I was not installing neither R or any shiny package in my shinyproxy Dockerfile.
So what I did, is pretty much copy most of my shiny Dockerfile but replacing:
FROM rocker/shiny:3.5.1 to FROM openanalytics/r-base

The question left I would only have is that both of these Dockerfile have in the lines :
COPY Rprofile.site /usr/lib/R/etc/
Is it necessary in both Dockerfiles? I feel like I should remove it from the shiny Dockerfile.

Thanks a lot for you patience and time @mnazarov !

I am glad you made it work.
The copying of Rprofile file is not necessary, it just makes it more convenient to run shiny apps - you can see the contents are just setting

options(shiny.port = 3838, shiny.host = "0.0.0.0")

If you don’t copy the file, you would need to specify port and host in the call to runApp for each application. If you don’t run your apps under shinyproxy (e.g. in your rstudio image), then this file will have no effect.

1 Like