Letztens hatte ich einen Post zu selten verwendeten Features bei docker-compose. Hier ein guter, aber oberflächlicher Artikel: 6 Docker Compose Best Practices for Dev and Prod
Daraufhin hat sich noch ein weiteres Feature aufgetan: profiles. Beispiel:
version: "3.9"
services:
frontend:
image: frontend
profiles: ["frontend"]
phpmyadmin:
image: phpmyadmin
depends_on:
- db
profiles:
- debug
backend:
image: backend
db:
image: mysql
Here the services
frontendandphpmyadminare assigned to the profilesfrontendanddebugrespectively and as such are only started when their respective profiles are enabled.
In den Kommentaren auf HN gibt es auch noch weitere Tipps.