質問編集履歴

2

情報追記

2023/02/27 03:48

投稿

oooz
oooz

スコア9

test CHANGED
File without changes
test CHANGED
@@ -105,6 +105,49 @@
105
105
  >
106
106
  ```
107
107
 
108
+ ### 追記
109
+ ```
110
+ docker compose ps
111
+ ```
112
+ でコンテナ内を確認し、
113
+ ```
114
+ postgres-1
115
+
116
+ laradock-postgres-1
117
+
118
+ postgres
119
+ ```
120
+ 上記にホストを書き換えましたが、エラーが出て進みません。
121
+
122
+ ```
123
+ docker compose ps
124
+
125
+ laradock-docker-in-docker-1
126
+ laradock-nginx-1
127
+ laradock-pgadmin-1
128
+ laradock-php-fpm-1
129
+ laradock-postgres-1
130
+ laradock-workspace-1
131
+
132
+ ```
133
+ エラー内容
134
+ ```error
135
+ postgres-1
136
+ could not translate host name "postgres-1" to address: Name or service not known.
137
+
138
+ laradock-postgres-1
139
+ password authentication failed for user "laradock".
140
+
141
+ pgadmin
142
+ could not connect to server: Connection refused
143
+ Is the server running on host "pgadmin" (172.19.0.2) and accepting
144
+ TCP/IP connections on port 5432?
145
+
146
+ postgres
147
+ password authentication failed for user "laradock".
148
+ ```
149
+
150
+
108
151
  ### 補足情報(FW/ツールのバージョンなど)
109
152
 
110
153
  macbook air使用

1

追記しました

2023/02/26 15:11

投稿

oooz
oooz

スコア9

test CHANGED
File without changes
test CHANGED
@@ -76,6 +76,35 @@
76
76
  変更後dockerの再起動、書き換え
77
77
  そのほかネット検索にて書き換えや、ファイルを削除し新たにやり直すなどを行いました。
78
78
 
79
+ ちなみに以下をターミナルで試すとこのようなエラーが出てしまいます。恐らくデータベースに接続できていないものだと思います。
80
+ ```
81
+ laradock@55efc171a703:/var/www$ php artisan tinker
82
+ Psy Shell v0.11.12 (PHP 7.4.33 — cli) by Justin Hileman
83
+ > DB::connection()->getConfig();
84
+ = [
85
+ "driver" => "pgsql",
86
+ "host" => "127.0.0.1",
87
+ "port" => "5432",
88
+ "database" => "laradock",
89
+ "username" => "laradock",
90
+ "password" => "laradock",
91
+ "charset" => "utf8",
92
+ "prefix" => "",
93
+ "prefix_indexes" => true,
94
+ "schema" => "public",
95
+ "sslmode" => "prefer",
96
+ "name" => "pgsql",
97
+ ]
98
+
99
+ > DB::connection()->getPdo();
100
+
101
+ PDOException SQLSTATE[08006] [7] could not connect to server: Connection refused
102
+ Is the server running on host "127.0.0.1" and accepting
103
+ TCP/IP connections on port 5432?
104
+
105
+ >
106
+ ```
107
+
79
108
  ### 補足情報(FW/ツールのバージョンなど)
80
109
 
81
110
  macbook air使用