Error launching app, port settings


#1

I’m having an issue when launching my application.
I’m trying to debug manually.
When I run
sudo docker run -p 3838:3838 tonyk7440/shiny_save

I get the error

shiny::runApp(’/root/shiny_save’,
+
+Error: unexpected end of input

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

at the end of my dockerfile.

But when I run:
sudo docker run -p 3838:3838 tonyk7440/shiny_save R -e "shiny::runApp('/root/shiny_save', host='0.0.0.0', port = 3838)"

It runs perfect, the reason why I’m forcing the port in dockerfile is because it seems it to launch on random ports if not.

Link to application: https://github.com/tonyk7440/shiny_save
Link to dockerfile: https://github.com/tonyk7440/shiny_save/blob/master/Dockerfile


#2

I also have another branch names no_port
git pull origin no_port

And when I try to run this interactively by just using
sudo docker run -p 3838:3838 tonyk7440/shiny_save

It runs but I get:

Listening on http://127.0.0.1:3548

instead of the usual

Listening on http://0.0.0.0:3838

I think this could be the reason why my application is unresponsive
Does anyone know what is going on that it is not starting on the right port?


#3

The spaces inside the command lead to the error.
CMD ["R", "-e", "shiny::runApp('/root/shiny_save', host='0.0.0.0', port=3838)"] should work.
Regarding the port, indeed by deafult shiny uses a random port, so you can’t easily expose it to shinyproxy, so you need to either pass it in the runApp call or use global option via e.g. Rprofile.site.


#4

Thank you very much, worked a treat!