-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcompose.yaml
More file actions
187 lines (187 loc) · 8.4 KB
/
compose.yaml
File metadata and controls
187 lines (187 loc) · 8.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: ros2-aloha-ws
services:
volume-instantiation:
# Ref: https://github.com/moby/moby/issues/47842#issuecomment-2249050939
# Note: We use individual `chown` commands instead of `chown -R` for performance.
# This chown is only required for empty volumes. If the volume happens to be non-empty,
# `chown -R` would be very time-consuming as it recursively changes ownership of all
# existing files and subdirectories.
image: ubuntu:22.04
container_name: ros2-aloha-ws-volume-instantiation
command: bash -c "
echo 'Creating directories and setting ownership for UID ${USER_UID:-1000}...' &&
mkdir -p /isaac-sim/.cache &&
mkdir -p /isaac-sim/.nv/ComputeCache &&
mkdir -p /isaac-sim/.nvidia-omniverse/{logs,config} &&
mkdir -p /isaac-sim/.local/share/ov/{data,pkg} &&
chown ${USER_UID:-1000}:${USER_UID:-1000} /isaac-sim &&
chown ${USER_UID:-1000}:${USER_UID:-1000} /isaac-sim/.cache &&
chown ${USER_UID:-1000}:${USER_UID:-1000} /isaac-sim/.nv{,/ComputeCache} &&
chown ${USER_UID:-1000}:${USER_UID:-1000} /isaac-sim/.nvidia-omniverse{,/logs,/config} &&
chown ${USER_UID:-1000}:${USER_UID:-1000} /isaac-sim/.local{,/share,/share/ov,/share/ov/data,/share/ov/pkg}
"
volumes:
- isaac-sim-cache:/isaac-sim
aloha-ws:
depends_on:
- volume-instantiation
build:
context: .
dockerfile: Dockerfile
# TODO: Specify the target platform to build the image, otherwise it will build for the host platform.
# Reference: https://docs.docker.com/compose/compose-file/build/#platforms
# platforms:
# - "linux/arm64"
args:
# TODO: Set the USER_UID
USER_UID: "${USER_UID:-1000}"
# TODO: Set CUDA Toolkit version or set to "" if not using CUDA Toolkit
# CUDA_TOOLKIT_VERSION: ""
# TODO: Set Isaac Sim version or set to "" if not using Isaac Sim
# ISAAC_SIM_VERSION: "5.1.0"
# TODO: Set Isaac Lab version or set to "" if not using Isaac Lab
# ISAAC_LAB_VERSION: "2.3.2"
# TODO: Set to "YES" if using Isaac ROS or set to "" if not using Isaac ROS
# ISAAC_ROS: ""
# TODO: Set to "YES" if using Cartographer or set to "" if not using Cartographer
# CARTOGRAPHER: ""
# TODO: Set to "YES" if using RTAB-Map or set to "" if not using RTAB-Map
# RTABMAP: ""
# TODO: Set to "YES" if using RealSense or set to "" if not using RealSense
# REALSENSE: ""
# TODO: Set to "YES" if using NVIDIA OpenUSD tools or set to "" if not using NVIDIA OpenUSD tools
# NV_OPENUSD: ""
# TODO: Set to "YES" if using Newton Tools or set to "" if not using Newton Tools
# NEWTON_TOOLS: ""
# TODO: Set to "YES" if using Claude Code CLI or set to "" if not using Claude Code CLI
# CLAUDE_CODE: ""
# TODO: Set to "YES" if using Codex CLI or set to "" if not using Codex CLI
# CODEX: ""
cache_from:
- j3soon/ros2-aloha-ws:buildcache-amd64
- j3soon/ros2-aloha-ws:buildcache-arm64
image: j3soon/ros2-aloha-ws
container_name: ros2-aloha-ws
stdin_open: true
tty: true
# TODO: Comment the line below if the workspace don't need to communicate through `/dev/*` devices.
privileged: true
command: /bin/bash
network_mode: host
working_dir: /home/ros2-essentials/aloha_ws
environment:
# Set X11 server environment variable for existing display.
- DISPLAY=$DISPLAY
# References:
# - https://docs.ros.org/en/humble/Concepts/Intermediate/About-Domain-ID.html
# - https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html
# - https://docs.ros.org/en/humble/Tutorials/Demos/Logging-and-logger-configuration.html#console-output-colorizing
- ROS_LOCALHOST_ONLY=0
# Localhost only is disabled by default to allow communication with external devices.
- ROS_DOMAIN_ID=0
# Domain ID is set to 0 to allow communication through ros1_bridge.
- RCUTILS_COLORIZED_OUTPUT=1
# TODO: Set the ROS middleware (RMW). Currently supported RMW implementations:
# - rmw_fastrtps_cpp (FastDDS) (default)
# - rmw_cyclonedds_cpp (CycloneDDS)
# Ref:
# - https://github.com/ros2/rmw_fastrtps/blob/d98cacec980df18810af232b75db80b5ce7da845/README.md
# - https://github.com/ros2/rmw_cyclonedds/blob/406277084be4352fa48357047ed56be69e4942e5/README.md
- RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# Set the ROS workspace path.
- ROS2_WS=/home/ros2-essentials/aloha_ws
# TODO: Add more environment variables here.
# Enable GPU support.
# Reference: https://docs.docker.com/compose/gpu-support/
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [ gpu ]
# Enable NVIDIA runtime (for older docker setup).
# Reference: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/sample-workload.html
# runtime: nvidia
volumes:
# Mount local timezone into container.
# Reference: https://stackoverflow.com/questions/57607381/how-do-i-change-timezone-in-a-docker-container
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
# Mount X11 server
- /tmp/.X11-unix:/tmp/.X11-unix
# X11-unix is mounted to allow GUI applications to display on host.
- $HOME/.Xauthority:/home/user/.Xauthority
# Xauthority is mounted to allow X11 forwarding for remote display.
# Mount Direct Rendering Infrastructure (DRI) for hardware acceleration support such as OpenGL.
- /dev/dri:/dev/dri
# Mount sound card to prevent Gazebo warning.
- /dev/snd:/dev/snd
# Mount shared memory for ROS2 communication.
- /dev/shm:/dev/shm
# TODO: Uncomment the line below and comment out the three entries above to enable USB support.
# - /dev:/dev
# Mount Gazebo models directory to reuse models downloaded during first launch.
# Reference: https://answers.ros.org/question/365658
# Note that this volume is shared among all workspaces.
- gazebo-cache:/home/user/.gazebo
# Note that this volume is shared among all workspaces.
- isaac-ros-assets:/home/user/workspaces/isaac_ros-dev/isaac_ros_assets
# Mount CycloneDDS configuration file.
- ./cyclonedds.xml:/home/user/cyclonedds.xml
# Mount Isaac Sim cache directories.
# Reference: https://docs.isaacsim.omniverse.nvidia.com/latest/installation/install_container.html#container-deployment
# Note that this volume is shared among all workspaces.
- type: volume
source: isaac-sim-cache
target: /home/user/.cache
volume:
subpath: .cache
- type: volume
source: isaac-sim-cache
target: /home/user/.nv/ComputeCache
volume:
subpath: .nv/ComputeCache
- type: volume
source: isaac-sim-cache
target: /home/user/.nvidia-omniverse/logs
volume:
subpath: .nvidia-omniverse/logs
- type: volume
source: isaac-sim-cache
target: /home/user/.nvidia-omniverse/config
volume:
subpath: .nvidia-omniverse/config
- type: volume
source: isaac-sim-cache
target: /home/user/.local/share/ov/data
volume:
subpath: .local/share/ov/data
- type: volume
source: isaac-sim-cache
target: /home/user/.local/share/ov/pkg
volume:
subpath: .local/share/ov/pkg
# TODO: Add more volume mounts here.
# Mount root workspace to allow easy access to all workspaces.
- ../..:/home/ros2-essentials
# Mount credentials (for Claude Code CLI, Codex CLI, and etc.)
- ${HOME}/docker/.claude:/home/user/.claude
- ${HOME}/docker/.claude.json:/home/user/.claude.json
- ${HOME}/docker/.codex:/home/user/.codex
# Add device cgroup rules to allow access to specific devices (like realsense).
# Reference: https://github.com/2b-t/docker-for-robotics/blob/main/doc/WorkingWithHardware.md
# Note that this is required only when using privileged: false.
# device_cgroup_rules:
# - 'c 81:* rmw'
# - 'c 189:* rmw'
volumes:
gazebo-cache:
name: ros2-gazebo-cache
external: true
isaac-sim-cache:
name: ros2-isaac-sim-cache
external: true
isaac-ros-assets:
name: ros2-isaac-ros-assets
external: true