0

I am trying to get a Shiny application working as a web server on a Digital Ocean droplet, using a docker image by rocker. All seems to be working fine, but somehow I cannot access the page through a browser.

Docker seems properly exposed to port 80 on the droplet: enter image description here

R seems to correctly listen to port 80 inside the docker container: enter image description here

Docker process listing looks correct: enter image description here

As does the machine listing: enter image description here

The command by which I started the container is:

docker run -d -p 80:80 --name ggplotgui jelkink/fpr

My Dockerfile looks as follows:

FROM rocker/shiny:latest
COPY . /srv/shiny-server/docker
RUN sudo apt-get install -y libssl-dev xdg-utils
RUN sudo R -e "install.packages(c('shiny', 'dplyr', 'plotly', 
'rmarkdown', 'ggplot2', 'readxl', 'haven', 'rio', 'stringr', 'readr', 
'devtools'))"
RUN chmod +x /srv/shiny-server/docker/continuous_shiny_run.sh
EXPOSE 80

CMD /srv/shiny-server/docker/continuous_shiny_run.sh

Although, to be honest, I also didn't manage to get it work under my local Docker installation, so perhaps it's unrelated to DigitalOcean.

Running the nginx hello world example on DigitalOcean - same droplet, different docker image - works just fine, including the use of port 80.

My Shiny code explicitly requests port 80:

shinyApp(ui, server, options = list(port = 80))
Jos Elkink
  • 26
  • 2

1 Answers1

2

Docker is binding to port 80 on the ipv6 interface only and not the ipv4 interface, you can tell from the missing tcp *:http entry in your netstat output.

Because of that, your connection to the ipv4 IP does not succeed and curl and others return "Connection refused".

See e.g. this Stack Overflow issue with details how to make Docker use the ipv4 interface.

Oliver
  • 11,857
  • 2
  • 36
  • 42