How to watch xvfb session that's inside a dock

2020-06-18 07:00发布

I'm running a docker (That I built on my own), that's docker running E2E tests. The browser is up and running but I want to have another nice to have feature, I want the ability of watching the session online.

My docker run command is:

docker run -p 4444:4444 --name ${DOCKER_TAG_NAME} 
           -e Some_ENVs 
           -v Volume:Volume 
           --privileged 
           -d "{docker-registry}" >> /dev/null 2>&1

I'm able to export screenshots but in some cases it's not enough and the ability of watching what is the exact state of the test would be amazing. I tried a lot of options but I came to a dead end, Any help would be great.

  • My tests are in Python 2.7
  • My Docker base is ubuntu:14.04
  • My environment is in AWS (If that's matter)
  • The docker runs on Ubuntu servers.

  • I know it a duplicate of this but no one answered him so...

2条回答
2楼-- · 2020-06-18 07:07

I have faced the same issue before with vnc, you need to know your xvfb/vnc in which port is using then open that port on you aws secuirty group once you done with that then you should be able to connect.

On my case i was starting selenium docker "https://github.com/elgalu/docker-selenium" and used this command to start the docker machine "docker run -d --name=grid -p 4444:24444 -p 5900:25900 \ -v /dev/shm:/dev/shm -e VNC_PASSWORD=hola \ -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1480 \ elgalu/selenium"

The VNC port as per the command is "5900" so i opened that port on instance security group, and connected using VNC viewer on port 5900

查看更多
Viruses.
3楼-- · 2020-06-18 07:15

There is a recent tool called Selenoid. It is launching browsers in Docker containers (i.e. headless as you require). It has a standalone UI capable to show live session screen via VNC. So you can launch multiple sessions in parallel and then look and even intercept actions happening in target browser. All this stuff perfectly works in cloud environment.

查看更多
登录 后发表回答