# Shiny app listening on wrong host

**URL:** <https://support.openanalytics.eu/t/shiny-app-listening-on-wrong-host/957>\
**Category:** ShinyProxy\
**Created:** [February 14, 2019, 3:47am UTC](https://support.openanalytics.eu/t/shiny-app-listening-on-wrong-host/957 "2019-02-14T03:47:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danny\_Beachnau](https://support.openanalytics.eu/user_avatar/support.openanalytics.eu/danny_beachnau/32/221_2.png) [@Danny\_Beachnau](https://support.openanalytics.eu/u/Danny_Beachnau)\
**Post date:** [February 14, 2019, 3:47am UTC](https://support.openanalytics.eu/t/shiny-app-listening-on-wrong-host/957/1 "2019-02-14T03:47:57Z")

</div>

When running my container it listens on the wrong host. I have other shiny apps that are working but when I try to run this one it reports that it is listening on `http://127.0.0.1:6479` when it should say that it is listening on `http://0.0.0.0:3838`. I am building my image from the Dockerfile below and then running a container with `docker run -p 3839:3838 --rm db/my_app R -e "shiny::runApp('/root/app/')"`.

Presumably, this explains the issue I am having where my container is reporting back unresponsive.

Dockerfile:

```
FROM openanalytics/r-base
 
MAINTAINER Daniel Beachnau "my_real_email@email.com"
 
# system libraries of general use
RUN apt-get update && apt-get install -y \
    sudo \
    gdebi-core \
    pandoc \
    pandoc-citeproc \
    libcurl4-gnutls-dev \
    libcairo2-dev \
    libxt-dev \
    libssl-dev \
    gsl-bin \
    libgsl0-dev \
    libxml2-dev \
    texlive-latex-base \
    texlive-fonts-recommended \
    texlive-fonts-extra \
    texlive-latex-extra \
    libmariadb-client-lgpl-dev
 
# basic shiny functionality
RUN R -e "install.packages(c('shiny', 'shinydashboard', 'shinythemes', 'devtools', 'tinytex','shinyWidgets','shinycssloaders','shinyBS','shinyjs','flexdashboard'), repos='https://cran.rstudio.com/')"
 
# install dependencies of the app
RUN R -e "devtools::install_github('hadley/ggplot2')"
RUN R -e "devtools::install_version('rmarkdown', version = '1.8', repos = 'http://cran.us.r-project.org')"
RUN R -e "install.packages(c('ggthemes','ggrepel','plyr','dplyr','plotly','scales','RColorBrewer','plotly','tidyr','RMySQL', 'numbers', 'lubridate', 'stringr', 'rlang', 'reshape2','jsonlite', 'knitr', 'kableExtra', 'gridExtra', 'xts', 'dygraphs'), repos='https://cran.rstudio.com/')"
RUN R -e "install.packages(c('RMySQL'), repos='https://cran.rstudio.com/')"
 
# copy the app to the image
RUN mkdir /root/app
COPY app /root/app
 
COPY Rprofile.site /usr/lib/R/etc/
 
EXPOSE 3838

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

```

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![mnazarov](https://support.openanalytics.eu/user_avatar/support.openanalytics.eu/mnazarov/32/216_2.png) [@mnazarov](https://support.openanalytics.eu/u/mnazarov)\
**Post date:** [February 14, 2019, 9:45am UTC](https://support.openanalytics.eu/t/shiny-app-listening-on-wrong-host/957/2 "2019-02-14T09:45:53Z")

</div>

Hi,

> [@Danny\_Beachnau](#):
>
> running a container with `docker run -p 3839:3838 --rm db/my_app R -e "shiny::runApp('/root/app/')"` .

By using the above you overwrite the `CMD` defined in the Dockerfile, so the `host` and `port` arguments are lost. You need to either add them to your run command, or just run the image with

```bash
docker run -p 3839:3838 --rm db/my_app

```

to use the default (defined in the Dockerfile’s `CMD`)

---

<div class="post-metadata">

**Author:** ![Danny\_Beachnau](https://support.openanalytics.eu/user_avatar/support.openanalytics.eu/danny_beachnau/32/221_2.png) [@Danny\_Beachnau](https://support.openanalytics.eu/u/Danny_Beachnau)\
**Post date:** [February 14, 2019, 10:21pm UTC](https://support.openanalytics.eu/t/shiny-app-listening-on-wrong-host/957/3 "2019-02-14T22:21:04Z")

</div>

seeing this now, of course I should have seen that solution.

That does still leave me bothered why in one image, running the command without host and port specified works as intended (listening on 0.0.0.0:3838) and the other does not. As far as I can tell, the differences between the images should not impact the networking (although, clearly I am wrong here). At any rate, the issue I was having is solved so at this point, this is just me venting some frustrations. Thank you for your input.

---

<div class="post-metadata">

**Author:** ![mnazarov](https://support.openanalytics.eu/user_avatar/support.openanalytics.eu/mnazarov/32/216_2.png) [@mnazarov](https://support.openanalytics.eu/u/mnazarov)\
**Post date:** [February 15, 2019, 9:03am UTC](https://support.openanalytics.eu/t/shiny-app-listening-on-wrong-host/957/4 "2019-02-15T09:03:36Z")

</div>

> [@Danny\_Beachnau](#):
>
> That does still leave me bothered why in one image, running the command without host and port specified works as intended (listening on 0.0.0.0:3838) and the other does not.

The `port` and `host` can also be defined in the global `options`, e.g. in an Rprofile file. In fact I see that you do include `Rprofile.site` in the Dockerfile, but could be that it’s contents are different across apps?
