nicbet/docker-phoenix

DB setup failed with non-existing domain

sasurau4 opened this issue · 3 comments

Overview

I followed the Getting started on README, the preparation of db failed. The error log is following.

❯ ./mix ecto.create
Starting battle-slot-server_db_1 ... done

11:37:40.119 [error] GenServer #PID<0.260.0> terminating
** (DBConnection.ConnectionError) tcp connect (db:5432): non-existing domain - :nxdomain
    (db_connection 2.3.1) lib/db_connection/connection.ex:100: DBConnection.Connection.connect/2
    (connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for BattleSlotServer.Repo couldn't be created: killed

dev.exs is following

config :test, Test.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "postgres",
  password: "postgres",
  database: "test_dev",
  hostname: "db",
  pool_size: 10

To fix this, adding env vars in docker-compose.yml like following.

  db:
    image: postgres:10
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_HOST=db

Thanks.

@sasurau4 good catch, will get on this ASAP.

Any luck with this one??

@kamanyi-git should have been taken care of by commit eff3277. Do you still encounter this problem?