2017-07-14 19 views
1

DockerでHaskellプロジェクトをビルドして実行しようとしています。プロジェクトにはPSQLデータベースが含まれています。 私は、実行コマンドdocker run project_name /usr/local/bin/project_nameを書くので、私は取得する場合:OS XでDockerを使用してHaskell/Postgresプロジェクトを構築できません

$ docker run carma-bundle /usr/local/bin/carma 
no port specified, defaulting to port 8000 
carma: 
Initializer threw an exception... 
libpq: failed (could not connect to server: Connection refused 
    Is the server running on host "localhost" (127.0.0.1) and accepting 
    TCP/IP connections on port 5432? 
could not connect to server: Cannot assign requested address 
    Is the server running on host "localhost" (::1) and accepting 
    TCP/IP connections on port 5432? 
) 

...but before it died it generated the following output: 
Initializing app @/
Initializing heist @ /heist 
...loaded 0 templates from /srv/snaplets/heist 
...adding 1 templates from resources/static/tpl with route prefix // 
Initializing CookieSession @ /session 
Initializing postgresql-simple @ /db 
Initializing postgresql-auth @ /auth 
...setting up filesystem 

追加情報:

$ docker --version 
Docker version 17.06.0-ce, build 02c1d87 

$ psql --version 
psql (PostgreSQL) 9.3.16 

$ stack --numeric-version 
1.4.0 

答えて

2

サーバがホスト "localhost" を(127.0.0.1)上で実行されていると
を受け入れているがポート5432上のTCP/IP接続?

これは、ローカルホスト上で、コンテナ内にpostgresが実行されていないことを示しています。

各コンテナには独自のローカルホストアドレスがあります。これらは、他のコンテナのlocalhostとは別のもので、Dockerが動作しているメインシステムのlocalhostアドレスとは別のものです。

関連する問題