-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
63 lines (62 loc) · 1.63 KB
/
docker-compose.yaml
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
# Docker Compose file for the C3pzero Robot
#
# Usage:
#
# To build the images:
# docker compose build cpu
# or
# docker compose build gpu
#
# To start up a specific service by name [cpu or gpu]:
# docker compose up <name>
#
# To open an interactive shell to a running container:
# (You can tab complete to get the container name)
# docker exec -it c3pzero bash
services:
cpu:
image: c3pzero:latest
container_name: c3pzero
build:
context: .
dockerfile: .docker/Dockerfile
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
privileged: true
command: /bin/bash
device_cgroup_rules:
- "c 81:* rmw"
- "c 189:* rmw"
environment:
# Default the ROS_DOMAIN_ID to zero if not set on the host
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-0}
# Allows graphical programs in the container
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
volumes:
# Mount the colcon workspace containing the source code
- ../../:/root/c3pzero_ws/:rw
# Allow access to host hardware e.g. joystick & sensors
- /dev:/dev
# Allows graphical programs in the container
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
gpu:
extends: cpu
container_name: c3pzero
command: /bin/bash
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
environment:
QT_X11_NO_MITSHM: 1
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DRIVER_CAPABILITIES: all