$ nc 127.0.0.1 5432 && echo success || echo no success no success
Example snippet from docker-compose:
DB/cache (e.g. Postgres & Redis, in this example Postgres):
[..]
ports:
- "5432:5432"
networks:
- backend
[..]
App: [..]
networks:
- backend
- frontend
[..]
networks:
frontend:
external: true
backend:
internal: true