安装
docker pull aerokube/selenoid-ui
docker pull aerokube/selenoid
docker pull selenoid/video-recorder:latest-release
docker pull selenoid/chrome:83.0
docker pull selenoid/vnc:chrome_83.0
如需其他浏览器,请参考:http://aerokube.com/images/latest/#_browser_image_information
启动
启动selenoid
docker run --rm -itd --name selenoid \
-p 4444:4444 \
-v /usr/etc/selenoid/:/usr/etc/selenoid/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /data/selenoid/video/:/data/selenoid/video/ \
-e OVERRIDE_VIDEO_OUTPUT_DIR=/data/selenoid/video/ \
--privileged aerokube/selenoid:latest \
-conf /usr/etc/selenoid/config/browsers.json -limit 20 -video-output-dir /data/selenoid/video/
注意:browsers.json所在目录需要挂载:-v /usr/etc/selenoid/:/usr/etc/selenoid/
browsers.json内容:
{
"chrome": {
"default": "64.0",
"versions": {
"64.0": {
"image": "selenoid/vnc:chrome_64.0",
"port": "4444",
"path": "/"
}
}
},
"firefox": {
"default": "59.0",
"versions": {
"59.0": {
"image": "selenoid/vnc:firefox_59.0",
"port": "4444",
"path": "/wd/hub"
}
}
},
"phantomjs":{
"default": "2.1.1",
"versions": {
"2.1.1": {
"image": "selenoid/phantomjs:2.1.1",
"port": "4444",
"path": "/"
}
}
}
}
启动selenoid-ui
docker run --rm -itd --name selenoid-ui -p 8080:8080 aerokube/selenoid-ui --selenoid-uri http://${SELENOID_HOST}:4444
SELENOID_HOST不能传localhost和127.0.0.1,因为selenoid和selenoid-ui并不在一个容器中,传实际ip,如:172.18.1.1。
访问selenoid-ui:http://172.18.1.31:8080/#/
ps:如需开启录制,需要设置enableVideo为True,默认为False
各种参考地址:
https://github.com/aerokube/selenoid
https://aerokube.com/selenoid/latest/#_getting_started
http://aerokube.com/selenoid-ui/latest/