user3142452
user3142452

Reputation: 23

Jenkins selenium docker and application files

I have a docker hub and a docker node up and running.I have also a docker container which includes my application up and running with the same set up as my pc. I get the following error. [ConnectionException] Can't connect to Webdriver at http://ip:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running. The IP is correct since I see there the selenium grid as it should be. Which might be the problem. When I get inside the container that i have in jenkins it runs my tests also.

Upvotes: -1

Views: 261

Answers (1)

Robbie Wareham
Robbie Wareham

Reputation: 3438

Have you explicitly instructed the Hub Docker Container to expose it's internal port 4444 as 4444 externally?

Instructing a container to expose ports does not enforce the same port numbers to be used. So in your case, while internally it is running on 4444, externally it could be whatever port Docker thought was the best choice when it started.

How did you start your container? If via the docker cmd line, then did you use -P or -p 4444:4444? (Note the difference in case). -P simply exposes ports but no guarantee of number, where as -p allows you to map as you wish.

There are many ways to orchestrate Docker which may allow you to control this in a different way.

For example, if you used Docker Compose that has the potential to allow your containers to communicate via 4444 even if those are not the actually exposed ports. It achieves this through some clever networking but is very simple to set up and use.

Upvotes: 0

Related Questions