'28P01: password authentication failed for user Postgres docker-compose.yaml

I have the below docker-compose and appsetting files. I can run this command dotnet ef migrations add initial-migration successfully whereas when I run dotnet ef database update, I am getting password authentication failed for user. I researched and most of the recommendation was due to the localhost. I used IP address for Host, but still did not work. Let me know if someone is familiar with this issue. Thanks!

**docker-compose**
version: "3"

services:
  cloud-postgres:
    image: debezium/postgres:13-alpine
    environment:
      - POSTGRES_DATABASE=cloud
      - POSTGRES_USER=cloud
      - POSTGRES_PASSWORD=cloud
    ports:
      - 5432:5432
    volumes:
      - postgres-data:/data/db

volumes:
  postgres-data:

**AppSetting**
"ConnectionStrings": {
    "AppDb": "Host=localhost;Port=5432;Username=cloud;Password=cloud;Database=cloud_db;"
  }



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source