-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompose.yml
More file actions
56 lines (51 loc) · 2.43 KB
/
compose.yml
File metadata and controls
56 lines (51 loc) · 2.43 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
# Docker Compose illustrating a VNC desktop container alongside a ROS container.
# The ROS container renders GUI applications (e.g. RViz) through the VNC desktop
# by sharing the X11 socket. Both services are on the same bridge network so
# CycloneDDS peer discovery works out of the box.
#
# Usage:
# No GPU: docker compose up
# With GPU: docker compose -f compose.yml -f compose.gpu.yml up
#
# Access the desktop at: http://localhost:5801/vnc.html?autoconnect=true
services:
# ── VNC Desktop ──────────────────────────────────────────────────────────────
vnc:
build:
context: ./docker # contains vnc-entrypoint.sh
dockerfile: ../vnc.dockerfile
target: xfce
ports:
- "5801" # noVNC web interface
volumes:
- x11:/tmp/.X11-unix # share X server socket with other containers
networks:
- ros_net
ipc: shareable # Allow other containers to access the IPC of the VNC container to allow data to go into it's X11
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5801/vnc.html"]
interval: 10s
timeout: 5s
retries: 5
# ── ROS Container ────────────────────────────────────────────────────────────
ros:
build:
context: ./docker # contains cyclonedds.xml
dockerfile: ../base.dockerfile
depends_on:
vnc:
condition: service_healthy # wait for VNC desktop to be ready before starting ROS
environment:
DISPLAY: ":1" # connect to the VNC X server
volumes:
- x11:/tmp/.X11-unix # X11 socket shared from VNC container
ipc: "service:vnc" # Use the IPC of the VNC container to allow access to X11 socket reliably
networks:
- ros_net
command: ["sleep", "infinity"]
# ── Shared resources ───────────────────────────────────────────────────────────
volumes:
x11: # ephemeral volume for the X11 unix socket
networks:
ros_net:
driver: bridge # CycloneDDS multicast works within a bridge network