STEPS:前端
0. Install Homebrewpython
1. Install 'Docker for Mac 18.03+',配置CPUs (n個CPUs,Bazel開n個線程編譯), Memory (>2G,編譯最小內存,推薦4G), Swap (>2G,推薦2G)git
2. git clone ... apollo ...redis
3. 進入apollo目錄,pull docker image for apollo (首次運行會pull 5G 的images)chrome
./docker/scripts/dev_start.shdocker
*注意 這裏的dev_start.sh須要修改下來適配Docker for Mac特性, 須要改爲手動配置端口映射:bootstrap
Replace--net host \
bash
with bellow, both 8887 and 8888 works.-p 8887:8887 -p 8888:8888 \
網絡
4. 進入apollo container by usingide
./docker/scripts/dev_into.sh
5. Docker for mac 的實現基於輕量虛擬機技術,網絡和文件系統共享完善。
在container中的/apollo文件夾直接映射host中的工做文件夾./apollo
6. 編譯
./apollo.sh build
(or)
./apollo.sh build_no_perception dbg
因爲macbook 13" 性能不佳或者網絡很差(編譯中可能會下載一個小文件),編譯可能中斷。
直接退出後重啓docker, 清空container,重啓apollo container進入接着編譯
Bazel會自動跳過已編譯過的項目。
整個編譯過程大概要~1h,須要約10G硬盤空間。
7. 編譯成功後運行
./scripts/bootstrap.sh
啓動
andrew@in_dev_docker:/apollo$ ./scripts/bootstrap.sh
Started supervisord with dev conf
Start roscore...
voice_detector: started
dreamview: started
Dreamview is running at http://localhost:8888
8. 在host mac上打開chrome輸入地址 localhost:8888
進入dreamview前端界面
From the dropdown box selet "Navigation" mode.
9. Replay demo rosbag
To see if the system works, use the demo 'bag' which feeds the system.
下載演示數據集 demo_2.5.bag (~約3G)
# get rosbag note that the command download is required python ./docs/demo_guide/rosbag_helper.py demo_2.5.bag
運行演示數據集 demo_2.5.bag
# You can now replay this demo "bag" in a loop with the '-l' flag rosbag play -l demo_2.5.bag
Dreamview should show a running vehicle now.
Comments:
1. Docker for mac的支持已經很好, mac能夠用作代碼編寫和編譯環境、模擬演示
2. 整個編譯運行空間,大約須要50G +,mac ssd!,macbook 13"編譯時間長
3. docker.qcow2 是docker用於存放image和container的單個文件,在docker for mac 中配置其大小最多爲60G。
=============================
du -sh 查看當前文件夾大小
du -sh * | sort -n 統計當前文件夾(目錄)大小,並按文件大小排序
Force-remove a running container
This command will force-remove a running container.
$ docker rm --force redis r
The main process inside the container referenced under the link redis will receive SIGKILL, then the container will be removed.
Remove all stopped containers
$ docker rm $(docker ps -a -q)
This command will delete all stopped containers. The command docker ps -a -q will return all existing container IDs and pass them to the rm command which will delete them. Any running containers will not be deleted.
Remove a container and its volumes
$ docker rm -v redis redis
This command will remove the container and any volumes associated with it. Note that if a volume was specified with a name, it will not be removed.