I have shinyproxy running in a docker container that is run with docker-compose, which also sets up a docker network called ‘shinyproxy-net’.
The apps run in their own docker containers of course, and the app.yml section for each includes:
container-network: 'shinyproxy-net'
which allows the app containers to reach servers outside of the host server.
That is all happening on an AWS EC2 instance.
On a separate EC2 instance on the same VPC (local subnet) I have a MongoDB server. I pass the local IP address of that server to the R code in each app using a container-env, (in my script-generated app.yml).:
container-env:
MONGODB_SERVER: 10.1.1.33
and the R code uses that to connect to the mongo server. THIS ALL WORKS GREAT.
I am now switching to a MongoDB replica set - three servers - for reliability purposes, among other reasons. The low level mongo drivers insist on getting the (locally-defined) hostnames of the replica-set servers and resolving them to IP addresses, even if I provide all three IP addresses as above. To get this to work properly, the app containers need to be able to resolve those names to IP addresses, e.g., something like:
mongodb-rs-1: 10.1.1.101
mongodb-rs-2: 10.1.1.102
mongodb-rs-3: 10.1.1.103
I can get these translations into the shinyproxy server /etc/hosts using extra_hosts:
in my shinyproxy server’s docker-compose yml config. But the app containers, where the resolution info is actually needed, cannot access that. This causes the app startup to fail, because the R code cannot connect to the replica-set servers.
I cannot see any way to get this into the app containers’ own /etc/hosts file, with the configuration options provided in the shinyproxy app.yml.
What options are there to achieve this?
Can I add “docker run” arguments for each app in the app.yml - so I can include --add-host flags?