Access local mongo database from container


Hi, Really enjoying using shinyproxy and making some good progress developing an app. I have hit a brick wall trying to connect to a mongo database that is on the same server but outside the app container. I have tried to use docker-network: host but this doesn’t seem to unlock it. I’m using mongolite to make the connection from with my app.

My yml file is below, any suggestions or pointers would be much appreciated.

title: DataMuster
logo-url: file:///Webstuff/DM1.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 8080
authentication: simple
admin-groups: scientists
# Example: ‘simple’ authentication configuration
- name: jack
password: password
groups: scientists
- name: jeff
password: password
groups: mathematicians
# Example: ‘ldap’ authentication configuration
url: ldap://,dc=com
user-dn-pattern: uid={0}
group-search-filter: (uniqueMember={0})
manager-dn: cn=read-only-admin,dc=example,dc=com
manager-password: password
# Docker configuration
cert-path: /home/none
port-range-start: 20000
contextPath: /

- ~shinyproxy/target/root/test


  • name: DataMuster
    display-name: Data Muster Demo
    docker-cmd: [“R”, “-e shiny::runApp(’/root/BelmontDataMuster’)”]
    docker-image: beldatamuster/demoapp
    groups: scientists
    docker-network: host



You probably want to take look at this thread Best practice of using database


Ok, thanks. I’ll give it a go, I was trying to get away with using existing infrastructure but this solution looks like it will provide some longer term benefits. I’ll let you know how I go. Thanks.


Thanks for your suggestion, it works really well. It took me a bit of time to understand container networks and I had some issues using mongolite. In the end the mongolite issue turned out to be a dependency issue in the main Docker file, it took me a bit of time to chase down the issue but once I found the problem and added the dependency it worked perfectly.

Once again thanks for your help.

Best wishes,