Deploying A 2nd, 3rd, 4th app

Hi, sorry for the noobie question here. I can follow along on the website and get my shiny apps up and running. But the only app that works is the last one I deployed. My guess is I’m not changing something important in the Dockerfile, but I don’t know what I could be missing. I’m working on Windows 10.

My process looks like this, using the euler demo app and 1 other example app:

  1. Follow all the steps in the Deploying Apps guide to get the Euler app running. Everything looks good.
  2. Copy the files in the Euler folder (Dockerfile, README, Rprofile, and an unnamed text file) into the folder containing my other app. (The other app is in another folder there - like the euler app is in a folder within the folder containing the DockerFile in the euler demo).
  3. Edit the Dockerfile.
    Change from:
    RUN mkdir /root/euler
    COPY euler /root/euler
    TO:
    RUN mkdir /root/MyApp1
    COPY FolderWithMyApp1 /root/MyApp1

and change from:
CMD [“R”, “-e”, “shiny::runApp(’/root/euler’)”]
to:
CMD [“R”, “-e”, “shiny::runApp(’/root/MyApp1’)”]

  1. From Docker, navigate to the folder with the new DockerFile, and run:
    docker build -t openanalytics/shinyproxy-template .

  2. Edit the application.yml file. Add a block like:

  • name: MyApp1
    display-name: MyApp1
    description: This is an App. It’s neat.
    docker-cmd: [“R”, “-e”, “shiny::runApp(’/root/MyApp1’)”]
    docker-image: openanalytics/shinyproxy-template
    groups: scientists

I can then run shinyproxy, and myApp1 works just fine. But the euler app no longer works. I get an Error: Status Code 500. Container did not respond in time.

I can go back to the euler app working by navigating to that folder in docker and running docker build -t openanalytics/shinyproxy-template ., but MyApp1 then no longer works. What is happening here? The other demo apps always work - the ones run with shinyproxy:: instead of shiny::runApp().

Thanks!

Hi @Literally.a.Goat,
When you run docker build -t openanalytics/shinyproxy-template . docker creates an image with the name (“tag”) that you specify, i.e. openanalytics/shinyproxy-template here. So if you run the same command on a different Dockerfile, the image gets overwritten, and that is the reason why only one app works. A solution would be to either use a different name (tag) for one of the apps and adjust docker-image in the application.yml accordingly, or to include both applications inside the same docker image, e.g. by keeping both sets of lines in the Dockerfile like:

RUN mkdir /root/euler
COPY euler /root/euler
RUN mkdir /root/MyApp1
COPY FolderWithMyApp1 /root/MyApp1

Note that CMD provides a default command to run when a container is started from that image, but you can override it with docker-cmd parameter. So your application.yml in that case would have:

apps:
- name: MyApp1
  display-name: myapp1
  description: This is an App. It’s neat.
  docker-cmd: [“R”, “-e”, “shiny::runApp(’/root/MyApp1’)”]
  docker-image: openanalytics/shinyproxy-template
  groups: scientists
- name: euler
  display-name: euler
  description: Euler app
  docker-cmd: [“R”, “-e”, “shiny::runApp(’/root/euler’)”]
  docker-image: openanalytics/shinyproxy-template
  groups: scientists

This is what is done in the other demo apps: there are two applications included in the same docker image.

1 Like

Thank you! That worked. Problem solved.