Should the check is successful the container is going to be marked as healthy. right until then it's going to continue to be in an unhealthy state.
regardless of whether your target is to produce a method for long run https://www.ralantech.com/postgresql-database-health-check-consulting-service/