ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.25k stars 9.72k forks source link

Unable to Access Dreamview When Booted on WSL 2 from Windows 11 Machine. #14329

Closed rZapp11 closed 2 years ago

rZapp11 commented 2 years ago

Hello, I am trying to run apollo on WSL2 in conjunction with LGSVL on Windows 11 Pro on the same machine. I have docker and apollo successfully installed. Additionally, starting up Dreamview in Ubuntu works. However, when I try to access the localhost:8888 link from Edge, Chrome, or Firefox, it refuses to connect. I have not seen this issue for WSL 2 in particular, so I figured it would not hurt to post this issue. Just a heads up, I am not very familiar with Ubuntu or with GitHub either, so you might have to spell things out for me occasionally. I appreciate any help offered.

System information

Steps to reproduce the issue:

Supporting materials (screenshots, command lines, code/script snippets):

The following text appears after running ./docker/scripts/dev_start.sh

ryan@DESKTOP-D6RS2V8:~/apollo$ ./docker/scripts/dev_start.sh [INFO] Use default GeoLocation settings [INFO] Start pulling docker image apolloauto/apollo:dev-x86_64-18.04-20210914_1336 ... dev-x86_64-18.04-20210914_1336: Pulling from apolloauto/apollo Digest: sha256:4c8749787adc30de8d64321589adfde5905c45fc22cfc5aee435e2ca5d20733f Status: Image is up to date for apolloauto/apollo:dev-x86_64-18.04-20210914_1336 docker.io/apolloauto/apollo:dev-x86_64-18.04-20210914_1336 [INFO] Remove existing Apollo Development container ... [INFO] Removing existing Apollo container: apollo_dev_ryan apollo_dev_ryan [INFO] Determine whether host GPU is available ... [INFO] USE_GPU_HOST: 1 [WARNING] No device named /dev/nvidia0 [WARNING] No device named /dev/nvidiactl [WARNING] No device named /dev/nvidia-uvm [WARNING] No device named /dev/nvidia-uvm-tools [WARNING] No device named /dev/nvidia-modeset [INFO] Starting mounting map volumes ... [INFO] Load map sunnyvale_big_loop from image: apolloauto/apollo:map_volume-sunnyvale_big_loop-latest [INFO] Create volume apollo_map_volume-sunnyvale_big_loop_ryan from image: apolloauto/apollo:map_volume-sunnyvale_big_loop-latest [INFO] Start pulling docker image apolloauto/apollo:map_volume-sunnyvale_big_loop-latest ... map_volume-sunnyvale_big_loop-latest: Pulling from apolloauto/apollo Digest: sha256:0a27ea953198d397fd7bf3b0e670951f6a9d645d362a8bdc707589a26cde8861 Status: Image is up to date for apolloauto/apollo:map_volume-sunnyvale_big_loop-latest docker.io/apolloauto/apollo:map_volume-sunnyvale_big_loop-latest [INFO] Load map sunnyvale_loop from image: apolloauto/apollo:map_volume-sunnyvale_loop-latest [INFO] Create volume apollo_map_volume-sunnyvale_loop_ryan from image: apolloauto/apollo:map_volume-sunnyvale_loop-latest [INFO] Start pulling docker image apolloauto/apollo:map_volume-sunnyvale_loop-latest ... map_volume-sunnyvale_loop-latest: Pulling from apolloauto/apollo Digest: sha256:1337ca5d357f33318e38368b6218d343f6138c63a9bb491175ca7cdd39c1a789 Status: Image is up to date for apolloauto/apollo:map_volume-sunnyvale_loop-latest docker.io/apolloauto/apollo:map_volume-sunnyvale_loop-latest [INFO] Load map sunnyvale_with_two_offices from image: apolloauto/apollo:map_volume-sunnyvale_with_two_offices-latest [INFO] Create volume apollo_map_volume-sunnyvale_with_two_offices_ryan from image: apolloauto/apollo:map_volume-sunnyvale_with_two_offices-latest [INFO] Start pulling docker image apolloauto/apollo:map_volume-sunnyvale_with_two_offices-latest ... map_volume-sunnyvale_with_two_offices-latest: Pulling from apolloauto/apollo Digest: sha256:5893abb847f7cffb5dd310f9bac307d5c2537797c247eb1c609f36de1943bdf5 Status: Image is up to date for apolloauto/apollo:map_volume-sunnyvale_with_two_offices-latest docker.io/apolloauto/apollo:map_volume-sunnyvale_with_two_offices-latest [INFO] Load map san_mateo from image: apolloauto/apollo:map_volume-san_mateo-latest [INFO] Create volume apollo_map_volume-san_mateo_ryan from image: apolloauto/apollo:map_volume-san_mateo-latest [INFO] Start pulling docker image apolloauto/apollo:map_volume-san_mateo-latest ... map_volume-san_mateo-latest: Pulling from apolloauto/apollo Digest: sha256:12b04dbfa947f7f06dc5c3b7604be08988c560e850c037a2571998478f0ccf80 Status: Image is up to date for apolloauto/apollo:map_volume-san_mateo-latest docker.io/apolloauto/apollo:map_volume-san_mateo-latest [INFO] Mount other volumes ... [INFO] Create volume apollo_audio_volume_ryan from image: apolloauto/apollo:data_volume-audio_model-x86_64-latest [INFO] Start pulling docker image apolloauto/apollo:data_volume-audio_model-x86_64-latest ... data_volume-audio_model-x86_64-latest: Pulling from apolloauto/apollo Digest: sha256:1491b6de2b71bd6bc6326bf70a945da69360e490724df78849f6d70ff4d00f61 Status: Image is up to date for apolloauto/apollo:data_volume-audio_model-x86_64-latest docker.io/apolloauto/apollo:data_volume-audio_model-x86_64-latest [INFO] Create volume apollo_yolov4_volume_ryan from image: apolloauto/apollo:yolov4_volume-emergency_detection_model-x86_64-latest [INFO] Start pulling docker image apolloauto/apollo:yolov4_volume-emergency_detection_model-x86_64-latest ... yolov4_volume-emergency_detection_model-x86_64-latest: Pulling from apolloauto/apollo Digest: sha256:b7b3dd17adb0c94a7392f32b268d5eb8ec619fa0269e1931846448706518901e Status: Image is up to date for apolloauto/apollo:yolov4_volume-emergency_detection_model-x86_64-latest docker.io/apolloauto/apollo:yolov4_volume-emergency_detection_model-x86_64-latest [INFO] Create volume apollo_faster_rcnn_volume_ryan from image: apolloauto/apollo:faster_rcnn_volume-traffic_light_detection_model-x86_64-latest [INFO] Start pulling docker image apolloauto/apollo:faster_rcnn_volume-traffic_light_detection_model-x86_64-latest ... faster_rcnn_volume-traffic_light_detection_model-x86_64-latest: Pulling from apolloauto/apollo Digest: sha256:c57fb57aba718ad948d27d98e50115c6955fbebf054e99c269aa4d1830384846 Status: Image is up to date for apolloauto/apollo:faster_rcnn_volume-traffic_light_detection_model-x86_64-latest docker.io/apolloauto/apollo:faster_rcnn_volume-traffic_light_detection_model-x86_64-latest [INFO] Create volume apollo_smoke_volume_ryan from image: apolloauto/apollo:smoke_volume-yolo_obstacle_detection_model-x86_64-latest [INFO] Start pulling docker image apolloauto/apollo:smoke_volume-yolo_obstacle_detection_model-x86_64-latest ... smoke_volume-yolo_obstacle_detection_model-x86_64-latest: Pulling from apolloauto/apollo Digest: sha256:848c0bc03e73898155a079576568d640ad6c6b2ec665d2ac2f1c46838f5c3fc9 Status: Image is up to date for apolloauto/apollo:smoke_volume-yolo_obstacle_detection_model-x86_64-latest docker.io/apolloauto/apollo:smoke_volume-yolo_obstacle_detection_model-x86_64-latest [INFO] Starting Docker container "apollo_dev_ryan" ...

Then, the following text appears after running ./docker/scripts/dev_into.sh

ryan@DESKTOP-D6RS2V8:~/apollo$ ./docker/scripts/dev_into.sh To run a command as administrator (user "root"), use "sudo ". See "man sudo_root" for details.

Then, the following text appears after running ./apollo.sh build_opt_gpu

[ryan@in-dev-docker:/apollo]$ ./apollo.sh build_opt_gpu [INFO] Apollo Environment Settings: [INFO] APOLLO_ROOT_DIR: /apollo [INFO] APOLLO_CACHE_DIR: /apollo/.cache [INFO] APOLLO_IN_DOCKER: true [INFO] APOLLO_VERSION: master-2022-02-14-1518cbc9d1 [INFO] DOCKER_IMG: dev-x86_64-18.04-20210914_1336 [INFO] APOLLO_ENV: STAGE=dev USE_ESD_CAN=false [INFO] USE_GPU: USE_GPU_HOST=1 USE_GPU_TARGET=1 [ OK ] Running GPU build on x86_64 platform. [WARNING] ESD CAN library supplied by ESD Electronics doesn't exist. [WARNING] If you need ESD CAN, please refer to: [WARNING] third_party/can_card_library/esd_can/README.md [INFO] Build Overview: [INFO] USE_GPU: 1 [ 0 for CPU, 1 for GPU ] [INFO] Bazel Options: --config=opt --config=gpu [INFO] Build Targets: //modules/... union //cyber/... [INFO] Disabled: except //modules/drivers/canbus/can_client/esd/... Starting local Bazel server and connecting to it... (05:43:30) INFO: Invocation ID: 2a8814e0-9f85-4af7-ad1a-faebc8b2a873 (05:43:31) INFO: Current date is 2022-02-27 (05:43:35) INFO: Analyzed 5452 targets (687 packages loaded, 20078 targets configured). (05:43:35) INFO: Found 5452 targets... (05:43:54) INFO: Elapsed time: 25.037s, Critical Path: 16.75s (05:43:54) INFO: 1 process: 1 internal. (05:43:54) INFO: Build completed successfully, 1 total action ============================================== [ OK ] Done building apollo. Enjoy! ==============================================

Finally, I start Dreamview with the following command ./scripts/bootstrap_lgsvl.sh

[ryan@in-dev-docker:/apollo]$ ./scripts/bootstrap_lgsvl.sh Starting modules/drivers/tools/image_decompress/launch/image_decompress.launch nohup: appending output to 'nohup.out' nohup: appending output to 'nohup.out' [ OK ] Launched module monitor. nohup: appending output to 'nohup.out' [ OK ] Launched module dreamview. Dreamview is running at http://localhost:8888

When I paste localhost into my browser, the following occurs

image

daohu527 commented 2 years ago

Pls run ./apollo.sh build_fe first to build the dreamview frontend then try again

rZapp11 commented 2 years ago

Pls run ./apollo.sh build_fe first to build the dreamview frontend then try again

@daohu527 Should I run ./apollo.sh build_fe in between ./docker/scripts/dev_into.sh and ./apollo.sh build_opt_gpu , or do I have the wrong idea? Thank you for responding btw. It is greatly appreciated.

daohu527 commented 2 years ago

you can do ./apollo.sh build_fe after ./docker/scripts/dev_into.sh.

By the way, pls init the env use below cmd after enter docker

source /apollo/scripts/apollo_base.sh
source /apollo/cyber/setup.bash
rZapp11 commented 2 years ago

@daohu527

I ran the following commands in ubuntu in this order 1.) cd apollo 2.) open docker desktop 3.) ./docker/scripts/dev_start.sh 4.) ./docker/scripts/dev_into.sh 5.) source /apollo/scripts/apollo_base.sh 6.) source /apollo/cyber/setup.bash 7.) ./apollo.sh build_fe

When running './apollo.sh build_fe' the following lines of code were output:

[ryan@in-dev-docker:/apollo]$ ./apollo.sh build_fe [INFO] Apollo Environment Settings: [INFO] APOLLO_ROOT_DIR: /apollo [INFO] APOLLO_CACHE_DIR: /apollo/.cache [INFO] APOLLO_IN_DOCKER: true [INFO] APOLLO_VERSION: master-2022-02-14-1518cbc9d1 [INFO] DOCKER_IMG: dev-x86_64-18.04-20210914_1336 [INFO] APOLLO_ENV: STAGE=dev USE_ESD_CAN=false [INFO] USE_GPU: USE_GPU_HOST=1 USE_GPU_TARGET=1 yarn run v1.22.5 $ ./setup.sh; node_modules/.bin/webpack --progress --mode=production ./gen_pbjs.sh: line 36: node_modules/protobufjs/bin/pbjs: No such file or directory ./gen_pbjs.sh: line 42: node_modules/protobufjs/bin/pbjs: No such file or directory /bin/sh: node_modules/.bin/webpack: No such file or directory error Command failed with exit code 127. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I am not sure how to fix the error that appeared in the second to last line. I checked the link, but it did not seem to be very helpful. Just in case, I did continue the process to see if it worked by running the following two commands:

8.) ./apollo.sh build_opt_gpu 9.) ./scripts/bootstrap_lgsvl.sh

However, I still got the same "refused to connect" message. Do you have any ideas about how to remedy the error that appeared when I ran './apollo.sh build_fe' ?

daohu527 commented 2 years ago

fix the error then, there is the problem!!

./setup.sh; node_modules/.bin/webpack --progress --mode=production
./gen_pbjs.sh: line 36: node_modules/protobufjs/bin/pbjs: No such file or directory
./gen_pbjs.sh: line 42: node_modules/protobufjs/bin/pbjs: No such file or directory
/bin/sh: node_modules/.bin/webpack: No such file or directory
rZapp11 commented 2 years ago

@daohu527

I am going to be honest here, I didn't really know how to interpret those lines other than that I need to obtain the files that are being referenced, but I do not know where to find them, or what protobufjs and webpack even refer to.

orangetcy commented 2 years ago

@rZapp11

Are you using WSL2 + Docker Desktop for Windows? If yes, maybe you can try using Linux docker or port mapping feature. Because Docker Desktop for Windows not support host net driver, under this condition apollo docker scripts will create host network in an isolate netork namespace which you cannot access. You can see official documents:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

I use port mapping to solve the problem:

  1. modify docker/scripts/dev_start.sh:

    replace "--net host \ " with "-p 8888:8888 \ "

  2. modify scripts/bootstrap.sh:

    replace DREAMVIEW_URL="http://localhost:8888" with DREAMVIEW_URL="http://0.0.0.0:8888"

Then follow the installation section and you can access to dreamview by http://${wsl2 instance ip}:8888. In my case, My wsl2 instance ip is 172.20.88.30, so I can access web service by http://172.20.88.30:8888/:

image

rZapp11 commented 2 years ago

@orangetcy I am using WSL2 and Docker Desktop for Windows, so I will give that a try. Thank you.

rZapp11 commented 2 years ago

@orangetcy Thank you, I am able to launch Firefox in a new Ubuntu WSL2 window and successfully access dreamview now.

pbarac00 commented 2 years ago

Hy, is it possible to do same thing but using win10 instead of win11?

orangetcy commented 2 years ago

Hy, is it possible to do same thing but using win10 instead of win11?

normally, it should be the same with wsl2. Maybe you can try this command in apollo dev docker to test if dreamview is working: curl http://localhost:8888 If get html code as output, maybe dreamview is working then try to solve docker/wsl2 network configuration problem. Otherwise, make sure your dreamview is working.

JasonBourne1998 commented 1 year ago

@rZapp11 @orangetcy

Are you using WSL2 + Docker Desktop for Windows? If yes, maybe you can try using Linux docker or port mapping feature. Because Docker Desktop for Windows not support host net driver, under this condition apollo docker scripts will create host network in an isolate netork namespace which you cannot access. You can see official documents:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

I use port mapping to solve the problem:

  1. modify docker/scripts/dev_start.sh:

    replace "--net host \ " with "-p 8888:8888 \ "

  2. modify scripts/bootstrap.sh:

    replace DREAMVIEW_URL="http://localhost:8888" with DREAMVIEW_URL="http://0.0.0.0:8888"

Then follow the installation section and you can access to dreamview by http://${wsl2 instance ip}:8888. In my case, My wsl2 instance ip is 172.20.88.30, so I can access web service by http://172.20.88.30:8888/:

image

May I know which IP address you used to connect to the bridge? I use lgsvl simulator and both localhost:9090 and wsl2 instance IP:9090 don't work. image

2019211753 commented 1 year ago

@rZapp11

Are you using WSL2 + Docker Desktop for Windows? If yes, maybe you can try using Linux docker or port mapping feature. Because Docker Desktop for Windows not support host net driver, under this condition apollo docker scripts will create host network in an isolate netork namespace which you cannot access. You can see official documents:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

I use port mapping to solve the problem:

  1. modify docker/scripts/dev_start.sh:

    replace "--net host \ " with "-p 8888:8888 \ "

  2. modify scripts/bootstrap.sh:

    replace DREAMVIEW_URL="http://localhost:8888" with DREAMVIEW_URL="http://0.0.0.0:8888"

Then follow the installation section and you can access to dreamview by http://${wsl2 instance ip}:8888. In my case, My wsl2 instance ip is 172.20.88.30, so I can access web service by http://172.20.88.30:8888/:

image

very grateful to you, save me a lot of time!

lisa0501 commented 1 week ago
  1. modify docker/scripts/dev_start.sh:

    replace "--net host \ " with "-p 8888:8888 \ "

in my case,just set port mapping,then it works! thanks