The troube is usual here, the question asked year by year every day, and the answer still same:
--url=jdbc:postgresql://localhost:5432/mydb
- you used localhost
here insted of service/container name, and that's mistake. Just use service or container name here instead of localhost.