images icon indicating copy to clipboard operation
images copied to clipboard

The ability to run in net=host mode

Open guskovd opened this issue 8 years ago • 6 comments

In the current implementation, the driver port inside the container is hardcoded. Therefore, it is not possible to run the container on the network host

I think this behavior can be fixed by adding an environment variable (--port=$SELENOID_PORT) in the entrypoint.sh file

guskovd avatar May 23 '17 21:05 guskovd

@guskovd: in Docker you can map any port in container to any port in operating system. So in the case of Selenoid images you just forward 4444 to any port you wish. What is the use case for this? What issue are you trying to fix with --net=host?

vania-pooh avatar May 24 '17 03:05 vania-pooh

Unfortunately, the networks in our openstack are arranged so that there is no way to run the containers in bridged mode It seems to me that the mode net=host is implemented for such cases.

guskovd avatar May 24 '17 09:05 guskovd

In that case I would use going to binaries instead of Docker. You may want to contact us in our Telegram support chat: https://t.me/joinchat/AAAAAAkZ1DfzAv-eYWTlTQ

vania-pooh avatar May 24 '17 09:05 vania-pooh

Why not just make the default port 4444 with the ability to change through the environment variable? in Dockerfile:

...
ENV SELENOID_NODE_PORT 4444
...

in entrypoint.sh:

#!/bin/bash
SCREEN_RESOLUTION=${SCREEN_RESOLUTION:-"1920x1080x24"}
/usr/bin/xvfb-run -a -s "-screen 0 $SCREEN_RESOLUTION -noreset" /usr/bin/chromedriver --port=$SELENOID_NODE_PORT --whitelisted-ips='' --verbose

guskovd avatar May 24 '17 10:05 guskovd

Alternatively, you can add an optional entrypoint.sh script argument: --port=<alt_port>

Then docker users in net=host mode will be able to run the container through the docker binary:

"image": ["docker", "run", "--net=host", .... ]

guskovd avatar May 24 '17 10:05 guskovd

We will remove -listen option from docker ENTRYPOINT in further release, it will allow to override port with command line option.

aandryashin avatar May 24 '17 15:05 aandryashin