nicbet / docker-phoenix

A dockerized Phoenix development and runtime environment.
GNU General Public License v3.0
277 stars 57 forks source link

DB setup failed with non-existing domain #18

Closed sasurau4 closed 3 years ago

sasurau4 commented 3 years ago

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.

nicbet commented 3 years ago

@sasurau4 good catch, will get on this ASAP.

dmytriiserhieiev commented 2 years ago

Any luck with this one??

nicbet commented 2 years ago

@kamanyi-git should have been taken care of by commit https://github.com/nicbet/docker-phoenix/commit/eff3277723114b74ae3f3c88dbd13e679cd906de. Do you still encounter this problem?