docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

How to make it run with net=host

Open lcacciagioni opened this issue 10 years ago • 7 comments

Is there any practical way to run selenium grid with net=host?

lcacciagioni avatar May 11 '16 08:05 lcacciagioni

Hey @lcacciagioni as in run the Selenium Grid Server on net=host VS -p 4444:4444... or do you mean the grid slave nodes?

robtec avatar Jun 01 '16 21:06 robtec

I would like to do this too, basically have the grid server on net=host and have the nodes connect connect to this server (should be at localhost).

robvelor avatar Jun 09 '16 23:06 robvelor

I would also like to do this (use net=host on nodes), but it cannot be done at the moment because the nodes require that you link the Selenium Hub. If you try to link the hub and use net=host, you will get the following error (on Windows): Conflicting options: host type networking can't be used with links. This would result in undefined behavior.

Would be cool if instead of requiring a link to the hub, you could optionally provide IP+port.

cbrevik avatar Jun 13 '16 08:06 cbrevik

@cbrevik That error should popup regardless of OS, I believe the browser images require the hub host to point to the selenium hub, so it might work by just adding the extra host to the browser containers?

robvelor avatar Jun 14 '16 16:06 robvelor

@robvelor That's pretty much what I said?

Anyway, you can add net=host without using link, by setting the correct environment variables (HUB_PORT_4444_TCP_ADDR and HUB_PORT_4444_TCP_PORT.

Something like: docker run -d -P -v /dev/shm:/dev/shm --net=host -e "HUB_PORT_4444_TCP_ADDR=10.0.75.2" -e "HUB_PORT_4444_TCP_PORT=4444" selenium/node-chrome

cbrevik avatar Jun 30 '16 14:06 cbrevik

To me default setting for google dns make no sense. How many people want to test pages that are currently in google DNS ??? Most will want their locally existing sites.

senpl avatar Feb 02 '17 15:02 senpl

The way to make it work is shown in this comment, nevertheless keep in mind that the --net=host only works currently in Linux machines where docker runs natively.

This is not working so far for Mac/Windows, but there is a workaround I explained in this comment.

Closing this issue.

diemol avatar Sep 08 '17 15:09 diemol