目的
Docker及びLaravelの勉強をするために、Docker for WindowsでLaradockを用いてLaravel環境を構築しています。
NginexとPostgreSQLを使っています。
マイグレーションを実行しようとするとエラーになってしまいましたが、解決方法が解らなかったため、ご教示願います。
エラー内容
実行コマンド
php artisan migrate
エラー内容
In Connection.php line 664: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "postgres" (172.19.0.3) and accepting TCP/IP connections on port 54320? (SQL: select * from information_schema.tables where table_schema = public and table_name = mig rations) In Connector.php line 67: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "postgres" (172.19.0.3) and accepting TCP/IP connections on port 54320?
関係ありそうだと思ったところ
laradock
ディレクトリ配下.env
ファイル内より抜粋
### POSTGRES ############################################## POSTGRES_VERSION=alpine POSTGRES_DB=test_db POSTGRES_USER=test_user POSTGRES_PASSWORD=testtesttest POSTGRES_PORT=54320 POSTGRES_ENTRYPOINT_INITDB=./postgres/docker-entrypoint-initdb.d ・ ・ ・ DB_HOST=postgres
プロジェクトディレクトリ配下.env
ファイル内より抜粋
DB_CONNECTION=pgsql DB_HOST=postgres DB_PORT=54320 DB_DATABASE=test_db DB_USERNAME=test_user DB_PASSWORD=testtesttest
###補足
php artisan make:migration
コマンドはうまく通り、下記のようになってます。
laradock@34bffa8e8fa2:/var/www$ php artisan make:migration create_posts_table --create=posts Created Migration: 2020_06_20_104822_create_posts_table
回答1件
あなたの回答
tips
プレビュー