I have a MySQL database running on Ubuntu and I try to connect to it from a Shiny app running in Shinyproxy (v. 2.5.0). However, I cannot get it to work. Whenever I try to connect to the database I get the 500 Error (Container did not respond in time). The lines that create the error are:
All the necessary libraries are installed and when I run the application from the container as
sudo docker run -it -p 3838:3838 --network="host" my_docker_image R -e "shiny::runApp('MyApp')"
it works fine. I set docker-network: host in application.yml to access the host MySQL database. I also tried specifying the socket as container-volumes: ["/var/lib/mysql/mysql.sock:/mysql.sock"] and tried adding the following lines to MySQL my.conf file:
[client]
protocol=tcp
I have set in application.yml container-network to host so that my R application should connect to MySQL server using 127.0.0.0 (or localhost, I have tried both).
docker-network: host should be specified in the section of application.yml related to the application since each application is a different container.
Otherwise, if you use the default bridge networking, then replace 127.0.0.1 with the IP address of the MySQL server.
I had already written docker-network: host in the specific application section of application.yml file. I also tried to replace 127.0.0.1 in app.R with the IP address of the host machine (it’s the same machine hosting MySQL, Docker and ShinyProxy), but the result is the same. I report the structure of the application.yml file I use.