Accessing shiny app via docker image on exposed port

Hello,

I am in the process of creating an image of my shinyapp via docker. I have created the dockerfile and it runs. The final portion of the script is the below. As you can see we expose the port and then we use the simple runApp command to get it to run.

EXPOSE 3838

RUN Rscript -e "shiny::runApp(host = '0.0.0.0', port = 3838, launch.browser = FALSE)"

In terms of the docker, I can see that is listening on the port and it is "running". You can see below is also referencing the correct port.

 => [14/14] RUN Rscript -e "shiny::runApp(host = '0.0.0.0', port = 3838, launch.browser = FALSE)"                                                                         322.1s
 => => # Loading required package: shiny
 => => # Loading required package: methods
 => => # Listening on http://0.0.0.0:3838

Upon trying to access the app via http://localhost:3838/ or http://0.0.0.0:3838/ doesn't lead to being able to access the app. I am having the same problems as described here: When running docker container with Shiny app, cannot access at 3838. I am building the image via vscode IDE. I don't know what I am misisng.

It finally worked specifying it as such and changing the order. This was rather silly.

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

EXPOSE 3838
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.