|
| 1 | +# Run Autoware in Docker |
| 2 | + |
| 3 | +## Image Graph |
| 4 | + |
| 5 | +```mermaid |
| 6 | +graph TD |
| 7 | + base(["base"]) |
| 8 | + base --> core-dependencies(["core-dependencies"]) |
| 9 | + core-dependencies --> core-devel(["core-devel"]) |
| 10 | + core-devel --> universe-dependencies(["universe-dependencies"]) |
| 11 | + universe-dependencies --> universe-dependencies-cuda(["universe-dependencies-cuda"]) |
| 12 | + universe-dependencies --> universe-devel(["universe-devel"]) |
| 13 | + universe-dependencies-cuda --> universe-devel-cuda(["universe-devel-cuda"]) |
| 14 | + base --> core(["core"]) |
| 15 | + core-devel -- " COPY /opt/autoware " --> core |
| 16 | + core --> universe-runtime-dependencies(["universe-runtime-dependencies"]) |
| 17 | + universe-runtime-dependencies --> universe(["universe"]) |
| 18 | + universe-runtime-dependencies --> universe-cuda(["universe-cuda"]) |
| 19 | + universe-devel -- " COPY /opt/autoware " --> universe |
| 20 | + universe-devel-cuda -- " COPY /opt/autoware " --> universe-cuda |
| 21 | + classDef base fill: #e8e8e8, color: #333 |
| 22 | + classDef devel fill: #bbdefb, color: #333 |
| 23 | + classDef runtime fill: #c8e6c9, color: #333 |
| 24 | + classDef cuda fill: #e1bee7, color: #333 |
| 25 | + class base base |
| 26 | + class core-dependencies,core-devel,universe-dependencies,universe-devel devel |
| 27 | + class core,universe-runtime-dependencies,universe runtime |
| 28 | + class universe-dependencies-cuda,universe-devel-cuda,universe-cuda cuda |
| 29 | +``` |
| 30 | + |
| 31 | +## Images |
| 32 | + |
| 33 | +| Image | Description | Use case | |
| 34 | +| ------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------- | |
| 35 | +| `base` | ROS base, sudo, pipx, ansible, RMW, user `aw` | Foundation for all other images | |
| 36 | +| `core-dependencies` | Build deps + compiled core packages (except autoware_core) | CI for autoware_core | |
| 37 | +| `core-devel` | Adds autoware_core build on top of core-dependencies | Development and CI for packages depending on autoware_core | |
| 38 | +| `core` | Runtime-only: rosdep exec deps + compiled core from core-devel | Lightweight core runtime | |
| 39 | +| `universe-dependencies` | Ansible universe roles + rosdep build deps for all of autoware | CI for autoware_universe | |
| 40 | +| `universe-dependencies-cuda` | Adds CUDA, TensorRT, spconv dev libs | CI for CUDA-dependent packages | |
| 41 | +| `universe-devel` | Builds all universe sources (no CUDA) | Development without GPU | |
| 42 | +| `universe-devel-cuda` | Builds all universe sources with CUDA | Development with GPU | |
| 43 | +| `universe-runtime-dependencies` | Runtime ansible roles + rosdep exec deps | Foundation for final runtime images | |
| 44 | +| `universe` | Runtime image with compiled autoware (no CUDA) | Deployment without GPU | |
| 45 | +| `universe-cuda` | Runtime image with compiled autoware + CUDA runtime libs | Deployment with GPU | |
| 46 | + |
| 47 | +## Build |
| 48 | + |
| 49 | +From the repository root: |
| 50 | + |
| 51 | +```bash |
| 52 | +# Build all default targets (universe + universe-cuda) |
| 53 | +docker buildx bake -f docker-new/docker-bake.hcl |
| 54 | + |
| 55 | +# Build a specific target (dependencies are resolved automatically) |
| 56 | +docker buildx bake -f docker-new/docker-bake.hcl core-dependencies |
| 57 | +docker buildx bake -f docker-new/docker-bake.hcl core-devel |
| 58 | +docker buildx bake -f docker-new/docker-bake.hcl universe-dependencies |
| 59 | +docker buildx bake -f docker-new/docker-bake.hcl universe-dependencies-cuda |
| 60 | +docker buildx bake -f docker-new/docker-bake.hcl universe-devel |
| 61 | +docker buildx bake -f docker-new/docker-bake.hcl universe-devel-cuda |
| 62 | +docker buildx bake -f docker-new/docker-bake.hcl core |
| 63 | +docker buildx bake -f docker-new/docker-bake.hcl universe-runtime-dependencies |
| 64 | +docker buildx bake -f docker-new/docker-bake.hcl universe |
| 65 | +docker buildx bake -f docker-new/docker-bake.hcl universe-cuda |
| 66 | + |
| 67 | +# Override variables |
| 68 | +docker buildx bake -f docker-new/docker-bake.hcl --set *.args.ROS_DISTRO=humble |
| 69 | +``` |
| 70 | + |
| 71 | +## Usage |
| 72 | + |
| 73 | +```bash |
| 74 | +xhost +local:docker |
| 75 | + |
| 76 | +docker run --rm -it \ |
| 77 | + --net host \ |
| 78 | + --privileged \ |
| 79 | + --gpus all \ |
| 80 | + -e DISPLAY=$DISPLAY \ |
| 81 | + -e NVIDIA_DRIVER_CAPABILITIES=all \ |
| 82 | + -e NVIDIA_VISIBLE_DEVICES=all \ |
| 83 | + -e HOST_UID=$(id -u) \ |
| 84 | + -e HOST_GID=$(id -g) \ |
| 85 | + -e QT_X11_NO_MITSHM=1 \ |
| 86 | + -v /tmp/.X11-unix:/tmp/.X11-unix:rw \ |
| 87 | + -v $HOME/autoware_map:/home/aw/autoware_map \ |
| 88 | + -v $HOME/autoware_data:/home/aw/autoware_data \ |
| 89 | + -v $HOME/projects/autoware:/home/aw/autoware \ |
| 90 | + -w /home/aw/autoware \ |
| 91 | + --runtime=nvidia \ |
| 92 | + autoware:universe-jazzy-cuda \ |
| 93 | + bash -c "source /opt/autoware/setup.bash && exec bash" |
| 94 | +``` |
| 95 | + |
| 96 | +Or run without volume mounting (the `autoware` folder is not present in the container): |
| 97 | + |
| 98 | +```bash |
| 99 | +docker run --rm -it \ |
| 100 | + --net host \ |
| 101 | + autoware:core-jazzy |
| 102 | +``` |
0 commit comments