首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Docker-Selenium Grid 4与Azure容器实例上的视频记录:无法打开显示错误

Docker-Selenium Grid 4与Azure容器实例上的视频记录:无法打开显示错误
EN

Stack Overflow用户
提问于 2021-12-30 09:30:15
回答 1查看 1.1K关注 0票数 0

给定带有容器定义的yaml文件definition.yml

代码语言:javascript
复制
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 : az登录az容器创建-资源-组名称-文件definition.yml运行的容器。

已部署容器,网格正在运行,但视频容器无法连接到网格

代码语言:javascript
复制
Cannot open display selenium-hub:99.0, error 1.
selenium-hub:99.0: Input/output error

完整的集装箱日志:

代码语言:javascript
复制
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://learn.microsoft.com/en-us/azure/container-instances/container-instances-reference-yaml

更新1:版本与集线器+节点+视频节点.节点被注册到集线器,但是视频节点失败,与独立节点的错误完全相同。

代码语言:javascript
复制
apiVersion: 2019-12-01
location: germanywestcentral
name: nameforcontainergroup2
properties:
  containers:
  - name: selenium-hub
    properties:
      image: selenium/hub:4.1.1-20211217
      resources:
        requests:
          cpu: 1
          memoryInGb: 1
      ports:
      - port: 4444
  - name: chrome-node
    properties:
      image: selenium/node-chrome:4.1.1-20211217
      resources:
        requests:
          cpu: 1
          memoryInGb: 2
      environmentVariables:
      - name: SE_EVENT_BUS_HOST
        value: localhost
      - name: SE_EVENT_BUS_PUBLISH_PORT
        value: 4442
      - name: SE_EVENT_BUS_SUBSCRIBE_PORT
        value: 4443
      - name: SE_NODE_PORT
        value: 5560
      - name: VNC_NO_PASSWORD
        value: 1
      volumeMounts:
      - name: devshm
        mountPath: /dev/shm
      - name: downloads
        mountPath: /home/seluser/downloads
  - 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: chrome-node
      - 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
EN

回答 1

Stack Overflow用户

发布于 2021-12-31 11:43:32

请检查这些参考资料是否给出了解决方法的想法:

请检查是否遗漏了给主机的端口,如selenium环境变量中的发布端口,并将其用于chrome.Make,肯定也会打开其他端口。并检查是否正确配置了selenium集线器和铬容器,并将其用于视频记录。

代码语言:javascript
复制
-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'

用于视频

代码语言:javascript
复制
- 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

…..

配置硒轮毂

代码语言:javascript
复制
-name:selenium-hub
image: selenium/hub:4.1.1-20211217
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"

参考资料:

  1. docker组合集环境变量-堆栈溢出
  2. Chrome Node没有正确注册到hub - Stack溢出。
  3. docker-compose v3-视频.在主干·(github.com)
  4. 错误:无法打开显示::99在Jenkins Ubuntu - Stack溢出
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70529733

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档