将docker flag --net = host传递给selenium / standalone-chrome-debug,图像失败

时间:2016-10-23 20:00:36

标签: selenium docker

尝试将--net = host添加到Selenium独立映像,以便它可以与localhost一起使用,但图像失败:

➜  ~ docker run --net=host -ti selenium/standalone-chrome-debug
sudo: unable to send audit message: Operation not permitted
Waiting xvfb...
sudo: unable to send audit message: Operation not permitted
/opt/bin/entry_point.sh: line 32:    17 Segmentation fault      (core dumped) sudo -E -i -u seluser $(for E in $(grep -vxFf asseluser asroot); do echo $E=$(eval echo \$$E); done) DISPLAY=$DISPLAY xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar ${SE_OPTS}
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
➜  ~ 

没有--net = host:

➜  ~ docker run -ti selenium/standalone-chrome-debug 
Waiting xvfb...
12:52:22.181 INFO - Selenium build info: version: '3.0.0', revision: '350cf60'
12:52:22.183 INFO - Launching a standalone Selenium Server
23/10/2016 12:52:22 passing arg to libvncserver: -rfbport
23/10/2016 12:52:22 passing arg to libvncserver: 5900

修改

Docker版本1.12.2

泊坞窗图像启动几秒钟,然后崩溃

➜  ~ docker ps
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS              PORTS               NAMES
27e750f48d1c        selenium/standalone-chrome-debug   "/opt/bin/entry_point"   5 seconds ago       Up 5 seconds                            romantic_hopper
➜  ~ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
谁知道为什么?

1 个答案:

答案 0 :(得分:0)

官方docker-selenium图片未使用--net=host AFAIK

进行测试

您也可以使用elgalu/docker-selenium

docker run --rm -ti --name=grid --net=host \
  --privileged=true --shm-size=1g \
  -e PICK_ALL_RANDMON_PORTS=true \
  -e SELENIUM_HUB_PORT=4444 \
  elgalu/selenium