Connecting Shiny app to MySQL database running on host gives “Container did not respond in time”

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:

stuffDB <- dbPool(
    user = "USERNAME",
    password = "PASSWORD",
    dbname = "DB_NAME",
    host = "",

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:


I have set in application.yml container-network to host so that my R application should connect to MySQL server using (or localhost, I have tried both).

The file contains

   options(shiny.port = 3838, = "")

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 with the IP address of the MySQL server.

1 Like

I had already written docker-network: host in the specific application section of application.yml file. I also tried to replace 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.

  title: TITLE
  landing-page: /
  heartbeat-rate: 15000
  heartbeat-timeout: 900000
  port: 8080
  template-path: ./html
  authentication: simple
  admin-groups: [group1, group2]
  container-wait-time: 20000
  - name: user1
    password: ****************
    groups: group1
  - name: user2
    password: ****************
    groups: group2
    cert-path: /home/none
    url: http://localhost:2375
    port-range-start: 20000
    container-protocol: http
  - id: APP_1
    display-name: App1
    description: App1
    container-image: docker_image_name
    docker-network: host
    access-groups: [group1, group2]

      max-file-size: 300MB
      max-request-size: 300MB