budtmo / docker-android

Android in docker solution with noVNC supported and video recording
Other
8.8k stars 1.19k forks source link

The emulator does not appear in the noVNC #120

Closed ruycostajr closed 5 years ago

ruycostajr commented 5 years ago

Operating System: Ubuntu 14.04 LTS x64

Docker Image: butomo1989/docker-android-x86-7.1.1, butomo1989/docker-android-real-device

Docker Version:
18.03.0-ce, build 0520e24

Docker-compose version (Only if you use it):
1.20.1, build 5d8c71b

Docker Command to start docker-android:
docker-compose up -d

Actual Behavior

The noVnc connects but the screen goes blank, only the appium terminal appears, docker-android

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6794404f06f7 butomo1989/docker-android-x86-7.1.1 "/bin/sh -c '/usr/biâ¦" 47 seconds ago Up 46 seconds (unhealthy) 4723/tcp, 5554-5555/tcp, 0.0.0.0:6080->6080/tcp android_nexus_7.1.1_1 0a92dc093b0a appium/appium "/bin/sh -c '/root/wâ¦" 48 seconds ago Up 47 seconds android_real_device_1 2b13d06abd7a selenium/hub:3.14.0-curium "/opt/bin/entry_poinâ¦" 49 seconds ago Up 47 seconds 0.0.0.0:4444->4444/tcp android_selenium_hub_1

Log from container 2018-09-14 11:36:36,143 CRIT Supervisor running as root (no user in config file) 2018-09-14 11:36:36,146 INFO supervisord started with pid 7 2018-09-14 11:36:37,149 INFO spawned: 'xvfb' with pid 10 2018-09-14 11:36:37,151 INFO spawned: 'port-forward' with pid 11 2018-09-14 11:36:37,154 INFO spawned: 'novnc' with pid 12 2018-09-14 11:36:37,156 INFO spawned: 'openbox' with pid 13 2018-09-14 11:36:37,159 INFO spawned: 'x11vnc' with pid 14 2018-09-14 11:36:37,162 INFO spawned: 'android-screen-mirror' with pid 16 2018-09-14 11:36:37,165 INFO spawned: 'docker-appium' with pid 21 2018-09-14 11:36:37,168 INFO spawned: 'auto-recording' with pid 22 2018-09-14 11:36:37,170 INFO spawned: 'adb-utils' with pid 23 2018-09-14 11:36:37,172 INFO success: android-screen-mirror entered RUNNING state, process has stayed up for > than 0 seconds (startsecs) 2018-09-14 11:36:37,180 INFO exited: android-screen-mirror (exit status 0; expected) 2018-09-14 11:36:38,217 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:38,217 INFO success: port-forward entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:38,217 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:38,217 INFO success: openbox entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:38,217 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:38,217 INFO success: docker-appium entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:38,218 INFO success: auto-recording entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:38,218 INFO success: adb-utils entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2018-09-14 11:36:43,180 INFO exited: auto-recording (exit status 0; expected)

docker-compose.zip

jacekmusial commented 5 years ago

I have similar situation, although I don't have even terminal, just empty black screen. The logs are interesting, because first program that exited with "1" is xvfb (exit status 1; not expected) following 5 next programs returning unexpected values.

Operating System: Debian 9 x64

Docker Image: butomo1989/docker-android-x86-8.1

Docker Version: Docker version 18.06.1-ce, build e68fc7a

Docker Command to start docker-android: git clone https://github.com/googlesamples/android-testing.git
docker run -it --rm -v $PWD/android-testing/ui/espresso/BasicSample:/root/tmp butomo1989/docker-android-x86-8.1 tmp/gradlew build

Logs 2018-09-15 12:24:44,304 CRIT Supervisor running as root (no user in config file), 2018-09-15 12:24:44,307 INFO supervisord started with pid 6, 2018-09-15 12:24:45,311 INFO spawned: 'xvfb' with pid 9, 2018-09-15 12:24:45,314 INFO spawned: 'port-forward' with pid 10, 2018-09-15 12:24:45,317 INFO spawned: 'novnc' with pid 11, 2018-09-15 12:24:45,320 INFO spawned: 'openbox' with pid 12, 2018-09-15 12:24:45,323 INFO spawned: 'x11vnc' with pid 13, 2018-09-15 12:24:45,329 INFO spawned: 'android-screen-mirror' with pid 14, 2018-09-15 12:24:45,334 INFO spawned: 'docker-appium' with pid 16, 2018-09-15 12:24:45,343 INFO spawned: 'auto-recording' with pid 22, 2018-09-15 12:24:45,357 INFO spawned: 'adb-utils' with pid 26, 2018-09-15 12:24:45,363 INFO exited: xvfb (exit status 1; not expected), 2018-09-15 12:24:45,367 INFO exited: android-screen-mirror (exit status 0; expected), 2018-09-15 12:24:45,384 INFO exited: openbox (exit status 1; not expected), 2018-09-15 12:24:45,406 INFO exited: x11vnc (exit status 1; not expected), 2018-09-15 12:24:45,564 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:46,396 INFO spawned: 'xvfb' with pid 63, 2018-09-15 12:24:46,397 INFO success: port-forward entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,397 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,399 INFO spawned: 'openbox' with pid 64, 2018-09-15 12:24:46,400 INFO success: auto-recording entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,400 INFO success: adb-utils entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,410 INFO spawned: 'x11vnc' with pid 67, 2018-09-15 12:24:47,553 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:47,553 INFO success: openbox entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:47,553 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:47,556 INFO spawned: 'docker-appium' with pid 82, 2018-09-15 12:24:47,702 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:49,707 INFO spawned: 'docker-appium' with pid 93, 2018-09-15 12:24:49,859 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:51,409 INFO exited: auto-recording (exit status 0; expected), 2018-09-15 12:24:53,414 INFO spawned: 'docker-appium' with pid 103, 2018-09-15 12:24:53,564 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:54,566 INFO gave up: docker-appium entered FATAL state, too many start retries too quickly,

image

irux commented 5 years ago

I have similar situation, although I don't have even terminal, just empty black screen. The logs are interesting, because first program that exited with "1" is xvfb (exit status 1; not expected) following 5 next programs returning unexpected values.

Operating System: Debian 9 x64

Docker Image: butomo1989/docker-android-x86-8.1

Docker Version: Docker version 18.06.1-ce, build e68fc7a

Docker Command to start docker-android: git clone https://github.com/googlesamples/android-testing.git docker run -it --rm -v $PWD/android-testing/ui/espresso/BasicSample:/root/tmp butomo1989/docker-android-x86-8.1 tmp/gradlew build

Logs 2018-09-15 12:24:44,304 CRIT Supervisor running as root (no user in config file), 2018-09-15 12:24:44,307 INFO supervisord started with pid 6, 2018-09-15 12:24:45,311 INFO spawned: 'xvfb' with pid 9, 2018-09-15 12:24:45,314 INFO spawned: 'port-forward' with pid 10, 2018-09-15 12:24:45,317 INFO spawned: 'novnc' with pid 11, 2018-09-15 12:24:45,320 INFO spawned: 'openbox' with pid 12, 2018-09-15 12:24:45,323 INFO spawned: 'x11vnc' with pid 13, 2018-09-15 12:24:45,329 INFO spawned: 'android-screen-mirror' with pid 14, 2018-09-15 12:24:45,334 INFO spawned: 'docker-appium' with pid 16, 2018-09-15 12:24:45,343 INFO spawned: 'auto-recording' with pid 22, 2018-09-15 12:24:45,357 INFO spawned: 'adb-utils' with pid 26, 2018-09-15 12:24:45,363 INFO exited: xvfb (exit status 1; not expected), 2018-09-15 12:24:45,367 INFO exited: android-screen-mirror (exit status 0; expected), 2018-09-15 12:24:45,384 INFO exited: openbox (exit status 1; not expected), 2018-09-15 12:24:45,406 INFO exited: x11vnc (exit status 1; not expected), 2018-09-15 12:24:45,564 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:46,396 INFO spawned: 'xvfb' with pid 63, 2018-09-15 12:24:46,397 INFO success: port-forward entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,397 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,399 INFO spawned: 'openbox' with pid 64, 2018-09-15 12:24:46,400 INFO success: auto-recording entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,400 INFO success: adb-utils entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:46,410 INFO spawned: 'x11vnc' with pid 67, 2018-09-15 12:24:47,553 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:47,553 INFO success: openbox entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:47,553 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs), 2018-09-15 12:24:47,556 INFO spawned: 'docker-appium' with pid 82, 2018-09-15 12:24:47,702 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:49,707 INFO spawned: 'docker-appium' with pid 93, 2018-09-15 12:24:49,859 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:51,409 INFO exited: auto-recording (exit status 0; expected), 2018-09-15 12:24:53,414 INFO spawned: 'docker-appium' with pid 103, 2018-09-15 12:24:53,564 INFO exited: docker-appium (exit status 0; not expected), 2018-09-15 12:24:54,566 INFO gave up: docker-appium entered FATAL state, too many start retries too quickly,

image

I have the same problem

ravelinx22 commented 5 years ago

Same here

ztiandan commented 5 years ago

Same here

ztiandan commented 5 years ago

Same here

luisromanbcn commented 5 years ago

Same here

sealabr commented 5 years ago

same problem

eyal919 commented 5 years ago

same

metaver5o commented 5 years ago

hi guys I believe you are having this issue because nested virtualization should be enabled. https://www.kernel.org/doc/Documentation/virtual/kvm/nested-vmx.txt I am trying to find in the code where the AVD VM is brought up by kvm/qemu. Its not in supervisor, and it seems if we add this flag, it should work -cpu qemu64,+vmx (add just the vmx feature to a named CPU type)

In case I get any success will let you know, BTW @butomo1989 your help is greatly appreciated.

cheers guys

budtmo commented 5 years ago

Hi,

Sorry for a late response but I cannot reproduce the error on my local machine by using Ubuntu 16.04 that you guys have. I am not sure if it is related with Linux type (e.g debian), but it would be great if you guys post the detail OS and spec of your machine that you use, so we can see on which Linux type and version this project is not able to run.

theriley106 commented 5 years ago

@butomo1989 I'm not sure if it's a setup issue on my end or just bad luck, but I'm getting this same issue on all of my machines.

HP Pavilion DV5-2070US w/ Ubuntu 16.04 Macbook Pro 15" (2012 Model) w/ El Capital (I think) ThinkPad Yoga 14 w/ Linux Mint 18

MatheusFaria commented 5 years ago

I was having the same issue with the API 27. I've changed to API 24 and now the emulator appears in the browser. It seems that the new kernel kernel-ranchu, it not supported by default for x86_64.

metaver5o commented 5 years ago

Hi guys, the problem is the nested virtualization. it runs fine when setup is "ubuntu 18.10 desktop - docker - kvm", however we need to automate android pipelines in the cloud, where the setup "vmware esxi server - ubuntu 16.10 vm - docker - kvm" does NOT work. Its because kvm needed to inherit some virtualization settings from the ubuntu vm, which can be made only by enabling nested virtualizaton in this vm at the vmware hypervisor layer. The guys from datacenter told me its "impossible" to make it work, but I have my doubts and will try further troubleshooting.

metaver5o commented 5 years ago

@MatheusFaria hi bro, good day would you mind sharing where this configuration you changed is located? I could find something at Emulator_x86 ARG API_LEVEL=21 thanks, Marco

pvsenan commented 5 years ago

I have the same issue as well. I'm using windows 10. Has anyone managed to solve it ?

MatheusFaria commented 5 years ago

@mmatoscom I've just downloaded this image butomo1989/docker-android-x86-7.0 But if would change the Dockerfile you should change the API_LEVEL, the PROCESSOR, and the SYS_IMG.

pvsenan commented 5 years ago

@MatheusFaria @mmatoscom butomo1989/docker-android-x86-7.0 is not working for me. But I have tried this https://github.com/laichimirum/docker-appium-emulator for windows. The device is showing up but its not booting. Can someone give it a shot and update whats happening ?

DieterRogiest commented 5 years ago

Kubuntu 18.04 here (on a real physical pc with an intel i3 of 2012) butomo1989/docker-android-x86-8.1 android works in http://localhost:6080 for me and rather responsive (except that its chrome browser renders some websites wrong: that android emulator is not exactly like the real thing). Where can I find info and fixes for the chrome browser of the emulated android not working exactly like the real life version? UPDATE: ah! In https://github.com/butomo1989/docker-android/issues/56 I find the reason why chrome on SGS6 displays sites with bad rendering and I managed to get it working with a correct resolution, although it is a bit cumbersome.

So it shows up on openbox: just using the scroll wheel makes the android screen disappear as you are scrolling to one of the four desktops of openbox and when you go back to desktop 1, the android screen no longer shows up (no idea whose fault is that). So I kill the emulator command /root/emulator/qemu/... and run "/bin/bash ./src/appium.sh" myself and then in openbox I rightclick and remove desktops 4, 3 and 2, leaving only desktop 1 so an accidental mouse scrolling doesn't break it again. Then I can play with the android screen: really disappointed that the emulator cannot render the website that I have to test correctly. UPDATE: see my update line a few lines above.

Also, on some occasions when running that container the x11vnc failed to start(or was it xvfb?) and thus also no emulator process.

The x86 images are for Linux, the arm images for OSX and MS Windows. I ran the arm image on OSX on a brand new Macbook Pro (intel i9): it took ages for that android screen to appear and was unusable. I tried running and pulling the x86 image in a VMware Fusion Linux VM on OSX but the download always failed after some time. So docker-android mostly works on a real Linux pc. Curious if there are people getting it to work on OSX or MS.

luisromanbcn commented 5 years ago

Guys, check that you are not launching the docker container with the -no-window option, if you have this option activated you will not be able to see the simulator in noVNC.

pvsenan commented 5 years ago

@luisromanbcn I'm not using -no-window switch but still no luck :(

Sakuragi commented 5 years ago

same problem,Has anyone managed to solve it ?

pvsenan commented 5 years ago

@Sakuragi Nope. I kind of gave up. Trying to find some alternative

beilunyang commented 5 years ago

have same problem, and tried all the above methods, but no solution...

awgeorge commented 5 years ago

Same here.

diemol commented 5 years ago

For the ones who cannot see the emulator, what do you see in the logs inside the container? Specifically in the /var/log/supervisor/docker-android.stdout.log?

awgeorge commented 5 years ago
screenshot 2018-12-07 at 01 08 06
awgeorge commented 5 years ago

Not sure if this helps, but the KVM doesn't appear to be working.

screenshot 2018-12-07 at 01 11 04
diemol commented 5 years ago

What OS are you using @awgeorge?

guozhanxian commented 5 years ago

What OS are you using @awgeorge?

I have the same problem , I use win10 and Docker version 18.09.0, build 4d60db4,and docker-android-x86-9.0

diemol commented 5 years ago

Well, please check the README

For OSX and Windows OS, please use Virtual Machine that support Virtualization with Ubuntu OS

The emulator is extremely slow or won't work properly in any other OS, due to the nested virtualization requirement.

awgeorge commented 5 years ago

@diemol @guozhanxian - I am trying to spin it up in Kubernetes - so not to sure what we're running the cluster on. I'll see if I can get the network guys to let me know.

awgeorge commented 5 years ago

Looks like it's built on CoreOS Container Linux (latest stable).

Vic020 commented 5 years ago

Same here, base on Debian 8.11

diemol commented 5 years ago

Have you all checked that you have nested virtualization in your VMs? What does the /var/log/supervisor/docker-android.stdout.log say in other cases?

awgeorge commented 5 years ago

I think that in our case, docker is not running in privileged mode, so it’s unable to support nested virtualization, we’re planning on running some tests to get that addressed, will keep you posted.

Sent from my iPhone

On 10 Dec 2018, at 14:28, Diego Molina notifications@github.com wrote:

Have you all checked that you have nested virtualization in your VMs? What does the /var/log/supervisor/docker-android.stdout.log say in other cases?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

guozhanxian commented 5 years ago

What OS are you using @awgeorge?

I have the same problem , I use win10 and Docker version 18.09.0, build 4d60db4,and docker-android-x86-9.0

Thanks @awgeorge ! I have resolved the problem when changing OS to Linux. But I met other problem see #132

mietzen commented 5 years ago

Same here :(

Mac OSx -> VBox -> Ubunut 18.04 untitled

KVM also doesn't work like here:

Not sure if this helps, but the KVM doesn't appear to be working.

screenshot 2018-12-07 at 01 11 04
luisromanbcn commented 5 years ago

Same here :(

Mac OSx -> VBox -> Ubunut 18.04

@mietzen it fails in your case because VBox doesn't allow to use Nested Virtualization so you cannot execute a simulator inside your VM, you need to use VMWare.

phal0r commented 5 years ago

I was facing the same problem and following @mmatoscom idea. My setup:

Windows 10, VMWare Workstation with virtualized Ubuntu 18. Everything works except that the emulator didn't spin up.

I followed the first steps of this tutorial: https://4sysops.com/archives/how-to-run-hyper-v-under-vmware-workstation/

It enables nested virtualization for Ubuntu and fixed the problem for me.

XinCai commented 5 years ago

i am facing the same issue. what is the solution ?

freekoy commented 5 years ago

you need to install kvm and turn on cpu virtualization

antwal commented 5 years ago

the image x86-8.0 not working i see this error on log, tried on Mac Host and Linux Host but i have same problem

emulator: CPU Acceleration: DISABLED emulator: CPU Acceleration status: KVM requires a CPU that supports vmx or svm emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure KVM is properly installed and usable. CPU acceleration status: KVM requires a CPU that supports vmx or svm

deviran01 commented 5 years ago

same issue. what is the solution ?

deviran01 commented 5 years ago

https://github.com/budtmo/docker-android/issues/147#issuecomment-473713697

Mardonov commented 5 years ago

Don't forget this: For OSX and Windows OS, please use Virtual Machine that support Virtualization with Ubuntu OS You can't run docker without virtualbox for mac/windows

tomcangbk commented 5 years ago

Ubuntu 16.04(Real Machine) Follow "Control Android connected to host (Emulator or Real Device)" docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 --name android-container-appium budtmo/docker-android-real-device When i open localhost:6080 still only a black screen with a small window inside with name "Android Screen Monitor" and display nothing. Top bar only got one button: send ctrl alt del p/s: i lookup to the log inside the container...but it only show this

root@006c4bec70b5:~# cat /var/log/supervisor/docker-android.stdout.log
Available types:
Selected type of deployment: , Template file:
Collecting data for improving the project
SaltStack is disabled
Using real device
Preparing appium-server...
Preparation is done
[Appium] Welcome to Appium v1.11.1
[Appium] Non-default server args:
[Appium]   logFile: /var/log/supervisor/appium.log
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
budtmo commented 5 years ago

Please make sure that the Virtualization on your machine is also enabled.

amitg25 commented 5 years ago

Don't forget this: For OSX and Windows OS, please use Virtual Machine that support Virtualization with Ubuntu OS You can't run docker without virtualbox for mac/windows

I am facing exact same issue and I understand this is mentioned in "READ.ME" but what does this line mean. Do we need to create a VirtualBox with Ubuntu image? and then how to use. It will be really really helpful if some can explain and provide steps for statement For OSX and Windows OS, please use Virtual Machine that support Virtualization with Ubuntu OS

tienvx commented 5 years ago

I faced the same problem. Doing these things solve my problem:

  1. Enable virtualization in BIOS https://www.youtube.com/watch?v=86zuELGMM9M
  2. Set privileged=true in docker-compose.yaml

    
    # https://github.com/budtmo/docker-android/blob/master/docker-compose.yml
    android:
        image: budtmo/docker-android-x86-9.0
        privileged: true
        links:
            - app:example.com
        depends_on:
            - hub
        ports:
            - 6080:6080
        environment:
            - DEVICE=Samsung Galaxy S7 Edge
            - CONNECT_TO_GRID=true
            - APPIUM=true
            - SELENIUM_HOST=hub
            - MOBILE_WEB_TEST=true
            - AUTO_RECORD=false
mcopjan commented 5 years ago

lucky you @tienvx. It does not work for me unfortunately. With your compose file when I open noVNC window I see running appium window, no simulator displayed. When I run "adb devices" from inside the container then there are no android devices detected :(