![](/img/trans.png)
[英]How do you load docker-selenium chrome standalone in azure container service?
[英]Docker-Selenium Grid 4 with Video recording on Azure Container Instances: Cannot open display error
给定 yaml 文件definition.yml
和容器定义
apiVersion: 2019-12-01
location: germanywestcentral
name: nameforcontainergroup
properties:
containers:
- name: selenium-hub
properties:
image: selenium/standalone-chrome:4.1.1-20211217
resources:
requests:
cpu: 1
memoryInGb: 1
environmentVariables:
- name: SCREEN_WIDTH
value: "1920"
- name: SCREEN_HEIGHT
value: "1080"
- name: VNC_NO_PASSWORD
value: 1
ports:
- port: 4444
- name: chrome-node-1-video
properties:
image: selenium/video:ffmpeg-4.3.1-20211217
resources:
requests:
cpu: 1
memoryInGb: 2
environmentVariables:
- name: DISPLAY_CONTAINER_NAME
value: selenium-hub
- name: FILE_NAME
value: chrome-node-video.mp4
volumeMounts:
- name: videos
mountPath: /videos
osType: Linux
volumes:
- name: devshm
emptyDir: {}
- name: downloads
emptyDir: {}
- name: videos
emptyDir: {}
ipAddress:
ports:
- protocol: tcp
port: '4444'
type: Public
dnsNameLabel: some-dns-label
tags: null
type: Microsoft.ContainerInstance/containerGroups
假设组group-name
存在,部署从 Azure CLI 运行的容器: az login az container create --resource-group group-name --file definition.yml
容器已部署,网格正在运行,但视频容器无法连接到网格
Cannot open display selenium-hub:99.0, error 1.
selenium-hub:99.0: Input/output error
完整的容器日志:
2021-12-30 09:06:38,504 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2021-12-30 09:06:38,508 INFO supervisord started with pid 31
2021-12-30 09:06:39,511 INFO spawned: 'video-recording' with pid 36
2021-12-30 09:06:39,515 INFO spawned: 'video-ready' with pid 37
Checking if the display is open...
2021-12-30 09:06:39,524 INFO success: video-recording entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2021-12-30 09:06:39,525 INFO success: video-ready entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Waiting before next display check...
Waiting before next display check...
Waiting before next display check...
Waiting before next display check...
Waiting before next display check...
Waiting before next display check...
Waiting before next display check...
Waiting before next display check...
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --enable-libaribb24 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[x11grab @ 0x556baa816b80] Cannot open display selenium-hub:99.0, error 1.
selenium-hub:99.0: Input/output error
2021-12-30 09:07:05,243 INFO exited: video-recording (exit status 1; not expected)
我错过了一些配置吗?
Yaml 参考: https://docs.microsoft.com/en-us/azure/container-instances/container-instances-reference-yaml
请检查参考是否提供了解决方法的想法:
请检查您是否错过了在 selenium 集线器环境变量中提供主机、端口等端口并将其用于 chrome。确保也打开其他端口。 并检查您是否为 selenium 集线器和 chrome 正确配置了容器,并将其用于视频录制。
-name: selenium-node-chrome
image: selenium/standalone-chrome:4.1.1-20211217
....
...
environmentVariables:
- name: SE_EVENT_BUS_HOST
value: selenium-hub
- name: SE_EVENT_BUS_PUBLISH_PORT
value: '4442'
- name: SE_EVENT_BUS_SUBSCRIBE_PORT
value: '4443'
- name: SE_NODE_HOST
value: node-chrome
- name: SE_NODE_PORT
value: '5555'
对于视频
- name: chrome-node-1-video
....//other properties
image: selenium/video:ffmpeg-4.3.1-20211217
.....
environmentVariables:
- name: DISPLAY_CONTAINER_NAME
value: selenium-node-chrome
- name: FILE_NAME
value: chrome-node-video.mp4
…..
配置 selenium-hub
-name:selenium-hub
image: selenium/hub:4.1.1-20211217
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
参考:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.