Container starts successfully and works, but ShinyProxy says "Container did not respond in time"

When trying to run a MRE for the other post in this forum, I came across a strange problem I could not fix myself.

The problem also appears identically when using the shinyproxy example images. So I guess it has nothing todo with the specific app.

The code can be found here (including instructions on what to do):

I have an image that works and looks nice.
I can also start ShinyProxy on port 3839 on the host machine with the following command:

docker run --publish 3839:8080 -v /var/run/docker.sock:/var/run/docker.sock --rm shinyproxy:latest

Looks good, too. Now when I want to start the app, ShinyProxy manages to start the app container instance (I can see this when looking at docker ps), and when opening the app container instance in a separate window it also works perfectly! But within the app window in ShinyProxy, the app will not appear and show an error instead (logs):

Container did not respond in time

output of docker ps after clicking on the app:

# docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED              STATUS              PORTS                                       NAMES
066e1a6e8616   testapp             "R -e 'shiny::runApp…"   18 seconds ago       Up 17 seconds       0.0.0.0:20100->3838/tcp                     cool_chatelet
08144db01812   shinyproxy:latest   "java -jar /opt/shin…"   About a minute ago   Up About a minute   0.0.0.0:3839->8080/tcp, :::3839->8080/tcp   silly_bartik

What am I doing wrong?

ShinyProxy manages to successfully start the app container instance and there is no R error since I can interact with that very same app container instance without problems, but ShinyProxy would not connect to it.

Thanks for help.

Hi

When you run shinyproxy in a container, you have to create a bridge network and specify this as a setting to the app. See https://github.com/openanalytics/shinyproxy-config-examples/tree/master/02-containerized-docker-engine and https://github.com/openanalytics/shinyproxy-config-examples/blob/master/02-containerized-docker-engine/application.yml#L25

1 Like

Thanks, that solved the problem. For those coming here from Google / ChatGPT:

  1. Make sure you have created a docker network with sudo docker network create sp-example-net (for example)
  2. In application.yml, add internal-networking: true to the docker section of the proxy settings, as well as container-network: sp-example-net to the container-network property of your app section
  3. Start with sudo docker run --publish 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock:ro --rm --group-add $(getent group docker | cut -d: -f3) --net sp-example-net shinyproxy:latest