Error launching app, port settings


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

+Error: unexpected end of input

I have
CMD ["R", "-e shiny::runApp('/root/shiny_save', host='', 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='', 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:
Link to dockerfile:


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

instead of the usual

Listening on

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?


The spaces inside the command lead to the error.
CMD ["R", "-e", "shiny::runApp('/root/shiny_save', host='', 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.


Thank you very much, worked a treat!