0

I trying connect to selenium, but I getting error:

Failed to connect to localhost port 4444: Connection refused

What is wrong? It is works normally in browser: http://localhost:4444/wd/hub/ and I see selenium.

I also tried connect to different port (eg. elastic) and it is these same.

John
  • 61
  • 2
  • 7

1 Answers1

0

You havent provided anough info on how your Dockerfile looks like and what command you're running to start the container. Please do that.

In any case here are some important points.

First in your dockerfile I hope you have

EXPOSE 4444

Secondly, if you just deploy your container using the docker run command, it will not be available to your localhost UNLESS you expose the required ports. Run your container with the below command :

docker run -p 4444:4444 -itd <IMAGE-ID>

Also make sure that the firewalld/iptables services on your machine are correctly configured to allow access to 4444

  • I used Laradock,your command return: docker: Error response from daemon: driver failed programming external connectivity on endpoint hopeful_goodall (0b6b5615c157b4275bb128c777da91de519451141cfca28c6aee00eb6e559b8f): Bind for 0.0.0.0:4444 failed: port is already allocated. I works from browser (http://localhost:4444/), put when I try connect from php code inside docker, its return error: Failed to connect to localhost port 4444: Connection refused – John Oct 28 '18 at 01:19