Docker Compose Commands
Docker Compose defines and manages multi-container apps with a single docker-compose.yml. Your environment already has it installed via docker-compose-plugin in the install guide, so the command is docker compose (note the space — not the legacy hyphenated docker-compose).
Start services
Create and start all services in the background as defined in docker-compose.yml:
docker compose up -dFor first-time debugging, run in the foreground to watch logs directly (Ctrl-C stops it):
docker compose upCheck service status
docker compose psView logs
Follow logs from all services in real time:
docker compose logs -fA single service only (e.g. ros-master):
docker compose logs -f ros-masterStop and clean up
Stop and remove containers and networks (volumes and images are kept):
docker compose downFull cleanup including volumes (data loss, use with care):
docker compose down -vRun a command inside a service
docker compose exec ros-node bashExample docker-compose.yml
A typical ROS 2 multi-node orchestration:
services: talker: image: ros:humble command: ros2 run demo_nodes_cpp talker environment: - ROS_DOMAIN_ID=1 restart: unless-stopped listener: image: ros:humble command: ros2 run demo_nodes_cpp listener environment: - ROS_DOMAIN_ID=1 depends_on: - talker restart: unless-stoppedAfter starting, the two nodes communicate across containers automatically:
docker compose up -ddocker compose logs -f