Article with code explanations: How to Setup Single-Primary PostgreSQL Replication with Docker-compose
Run primary and replica in background:
docker-compose up -d postgres_primary postgres_replica
Stop all services and remove volumes:
docker-compose down -v