Following the Getting Started Tutorial for Docker Compose, get fatal error when using my own config file

As the note says, I first edit the nakama:volumes line in the config file as I’m on Windows:

/c/Users/<my username>/projects/docker/data:/nakama/data

This creates the data directory in the above userpath. Next, I add a test-config.yml and my nakama:entrypoint entry looks like this:

entrypoint:
      - "/bin/sh"
      - "-ecx"
      - >
          /nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
          /nakama/nakama --config /nakama/data/test-config.yml &&
          exec /nakama/nakama --name nakama1 --database.address root@cockroachdb:26257 --logger.level DEBUG --session.token_expiry_sec 7200 --metrics.prometheus_port 9100

and when I do “docker compose up”, it gives me:

{"level":"fatal","ts":"2024-01-17T21:30:06.009Z","caller":"server/db.go:86","msg":"Error pinging database","error":"failed to connect to `host=localhost user=root database=nakama`: dial error (dial tcp [::1]:26257: connect: cannot assign requested address)

SOLUTION:

Entrypoint should be written as such:

entrypoint:
      - "/bin/sh"
      - "-ecx"
      - >
          /nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
          exec /nakama/nakama --name nakama1 --database.address root@cockroachdb:26257 --logger.level DEBUG --session.token_expiry_sec 7200 --metrics.prometheus_port 9100 
          --config /nakama/data/test-config.yml