Running container locally not working

Hi,
I’m new to ShinyProxy, thus I succeded installing it to my Linux server and got a first example app running. For this I followed the OpenAnalytics instructions.
Now I want to deploy my first own app. I wrote a dockerfile following the instructions from the website (https://www.shinyproxy.io/documentation/deploying-apps/). The image built successfully and the container is also starting. I can see in the logs that the Shiny app starts and is running (shiny::runApp(/root/dockertest), “Listening on http://127.0.0.1:5534”). But I cannot connect to the app via browser. I tried various ports and canot connect to any of the ports, also not the ones configure via Docker (e.g. 8081).
What am I doing wrong? Is the image not correct? Is the example not suited to be run in a container?
I’m using MacOS 13.2.1 and the latest Docker version.

Hi,
Looking at

it means you haven’t fixed the shiny port for your application. In the example linked above it is done in the Rprofile.site file, but this can also be done in the CMD line of the docker file (or container-cmd in application.yml), e.g.:

CMD ["R", "-e", "shiny::runApp('/root/euler', port=3838, host='0.0.0.0')"]
1 Like

Hi Maxim,
thank you, including the following line works and connects the app to the outside world:

CMD ["R", "-e", "shiny::runApp('/root/dockertest', port=3838, host='0.0.0.0')"] 

My original dockerfile actually includes the Rprofile.site, so I don’t know what is wrong here. I’m using rocker/r-ver to speed up the build process:

FROM rocker/r-ver:4.2.2
# add the maintainer of this Docker image (this should be you in this case)
LABEL maintainer "xx <my_email>"
# system libraries of general use
RUN apt-get update && apt-get install -y \

sudo \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libssl-dev \
libssh2-1-dev \
libssl3 \
&& rm -rf /var/lib/apt/lists/*

RUN R -e "install.packages(c('shiny'))" \
&& strip /usr/local/lib/R/site-library/*/libs/*.so

RUN mkdir /root/dockertest
COPY Testapp /root/dockertest

COPY Rprofile.site /usr/lib/R/etc/

# instruct Docker to expose port 3838 to the outside world
# (otherwise it will not be possible to connect to the Shiny application)

EXPOSE 3838

# finally, instruct how to launch the Shiny app when the container is started
CMD ["R", "-e", "shiny::runApp('/root/dockertest')"]

The above dockerfile runs successfully, but I cannot connect to the shiny app. Changing the last line to

CMD ["R", "-e", "shiny::runApp('/root/dockertest', port=3838, host='0.0.0.0')"]

works. So it seems like the Rprofile.site is not included properly?

Indeed, and this is because rocker/r-ver has R in a different location - so you should copy the Rprofile.site file to /usr/local/lib/R/etc instead of /usr/lib/R/etc

1 Like

Thank you. Funny enough, the following does not work as supposed:

COPY Rprofile.site /usr/local/lib/R/etc/

I also tried

COPY Rprofile.site "${R_HOME}"/etc/

, which did not work either.

My Rprofile.site looks like this:

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

I don’t know why the app only works when I directly instruct shiny to use port=3838 and host=‘0.0.0.0’.

Changing to /usr/local/lib/R/etc worked for me. Did you happen to solve this @sp_noobi?