Docker Community Forums

Share and learn in the Docker community.

Getting app inside one docker container to see ports on another

I’m fairly new to docker, so I need some help getting a couple containers to communicate to each other.

I’m using an R Shiny app to scrape web data on an AWS EC2 server. Before I dockerized the app, I would run the Shiny app, which would use RSelenium to scrape the web data I’m interested in. Before I started the app, I would download the selenium firefox image from Selenium and run the docker container with :

sudo docker run -d -p 4445:4444 selenium/standalone-firefox:3.141.59

Then, in the R script, I would run this code to get it to open the headless browser:

library(RSelenium)
remDr <- remoteDriver(port = 4445L)
remDr$open()
remDr$navigate("www.google.com")

This worked perfectly.

Now, I’m trying to launch the Shiny app in a docker container so that I can control its behavior better, but when I run the docker container and connect to the local host to run the app, and I start the web scraping, I get this error:

Error in checkError: Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused.

I have the Selenium Docker container running already, so I guess they just can’t see each other. Maybe I’m missing something obvious.

Thanks!

Evan