I have a docker-compose file of postgres but getting error at the time of running.
docker-compose file content
version: ‘3’
services:
postgres:
container_name: postgres
image: postgres:9.6-alpine
environment:
- POSTGRES_DB=nakama
- POSTGRES_PASSWORD=localdb
volumes:
- data:/var/lib/postgresql/data
expose:
- “8080”
- “5432”
ports:
- “5432:5432”
- “8080:8080”
nakama:
container_name: nakama
image: heroiclabs/nakama:2.4.1
entrypoint:
- “/bin/sh”
- “-ecx”
- >
/nakama/nakama migrate up --database.address postgres@postgres:5432/nakama &&
exec /nakama/nakama --name nakama1 --database.address postgres@postgres:5432/nakama --logger.level DEBUG --session.token_expiry_sec 7200
restart: always
links:
- “postgres:db”
depends_on:
- postgres
volumes:
- ./:/nakama/data
expose:
- “7349”
- “7350”
- “7351”
ports:
- “7349:7349”
- “7350:7350”
- “7351:7351”
healthcheck:
test: [“CMD”, “curl”, “-f”, “http://localhost:7350/”]
interval: 10s
timeout: 5s
retries: 5
volumes:
data:
=======================================
command to run
docker-compose -f ./docker-compose-postgres.yml up
ERROR
Creating postgres … done
Creating nakama … done
Attaching to postgres, nakama
nakama | + /nakama/nakama migrate up --database.address postgres@postgres:5432/nakama
postgres | Error: Database is uninitialized and superuser password is not specified.
postgres | You must specify POSTGRES_PASSWORD to a non-empty value for the
postgres | superuser. For example, “-e POSTGRES_PASSWORD=password” on “docker run”.
postgres |
postgres | You may also use “POSTGRES_HOST_AUTH_METHOD=trust” to allow all
postgres | connections without a password. This is not recommended.
postgres |
postgres | See PostgreSQL documentation about “trust”:
postgres | https://www.postgresql.org/docs/current/auth-trust.html
postgres exited with code 1
nakama | {“level”:“info”,“ts”:“2020-07-25T03:13:28.112Z”,“msg”:“Database connection”,“dsn”:“postgres@postgres:5432/nakama”}
nakama | {“level”:“fatal”,“ts”:“2020-07-25T03:13:28.377Z”,“msg”:“Error pinging database”,“error”:“dial tcp: lookup postgres on 127.0.0.11:53: no such host”,“stacktrace”:“github.com/heroiclabs/nakama/migrate.Parse\n\t/go/src/github.com/heroiclabs/nakama/migrate/migrate.go:145\nmain.main\n\tmain.go:77\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:200”}