Drupal容器无法连接到Postgres容器

时间:2020-05-07 01:12:13

标签: docker drupal

我正在学习有关Docker的UDemy课程,并且必须设置我可以访问的drupal。但是,它找不到postgres容器。 Drupal给我这个错误:

无法连接到数据库服务器。服务器报告以下消息:SQLSTATE [08006] [7]无法连接到服务器:连接被拒绝服务器是否在主机“ postgres”(172.18.0.3)上运行并在端口5432上接受TCP / IP连接? >

两个容器都在默认网络上。 用户名,数据库名称,主机为postgres,密码为示例。我使用的端口是5432。我不明白什么?阿洛斯,为什么必须再次在撰写文件的底部列出这些卷?

  1 version: '3.3'
  2
  3 services:
  4   drupal:
  5     image: drupal:latest
  6     ports:
  7       - 80:80
  8     volumes:
  9       - drupal_modules:/var/www/html/modules
 10       - drupal_profiles:/var/www/html/profiles
 11       - drupal_themes:/var/www/html/themes
 12       - drupal_sites:/var/www/html/sites
 13     restart: always
 14
 15   postgres:
 16     image: postgres:10
 17     environment:
 18       POSTGRES_PASSWORD: example
 19     restart: always
 20
 21 volumes:
 22   drupal_modules:
 23   drupal_profiles:
 24   drupal_themes:
 25   drupal_sites:
 26   db_data:

dockerfile是

FROM drupal:latest

Postgres容器日志

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 13:59:53.867543 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 13:59:53.867733 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

复数日志

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 00:35:44.074037 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 00:35:44.075675 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
75.173.77.33 - - [07/May/2020:00:36:31 +0000] "GET / HTTP/1.1" 302 609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:35 +0000] "GET /core/install.php HTTP/1.1" 200 4289 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:32 +0000] "GET /core/install.php HTTP/1.1" 200 4290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:42 +0000] "GET /core/misc/icons/333333/caret-down.svg HTTP/1.1" 200 490 "http://hardrock3022c.mylabserver.com/core/themes/seven/css/components/form.css?0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:42 +0000] "GET /core/misc/favicon.ico HTTP/1.1" 200 5731 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:44 +0000] "POST /core/install.php HTTP/1.1" 302 883 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:44 +0000] "GET /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 200 3135 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:45 +0000] "GET /core/misc/icons/e29700/warning.svg HTTP/1.1" 200 701 "http://hardrock3022c.mylabserver.com/core/themes/classy/css/components/messages.css?0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:47 +0000] "POST /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 302 984 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:48 +0000] "GET /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4057 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:37:51 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4459 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:38:33 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4445 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:27 +0000] "GET / HTTP/1.1" 302 609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:27 +0000] "GET /core/install.php HTTP/1.1" 200 4288 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:30 +0000] "POST /core/install.php HTTP/1.1" 302 883 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:30 +0000] "GET /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 200 3129 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:33 +0000] "POST /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 302 984 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:33 +0000] "GET /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4071 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:45:08 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4444 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
[Thu May 07 00:48:59.878165 2020] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 00:51:09.502463 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 00:51:09.520331 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
75.173.77.33 - - [07/May/2020:00:51:13 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4437 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:51:19 +0000] "GET /core/misc/favicon.ico HTTP/1.1" 200 5732 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:51:32 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4444 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
83.97.20.29 - - [07/May/2020:01:32:41 +0000] "GET / HTTP/1.0" 302 603 "-" "-"
[Thu May 07 02:46:16.660497 2020] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 04:17:22.474464 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 04:17:22.475579 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Thu May 07 04:18:58.323031 2020] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 13:38:08.126458 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 13:38:08.128021 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
75.173.77.33 - - [07/May/2020:14:07:48 +0000] "GET / HTTP/1.1" 302 609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:48 +0000] "GET /core/install.php HTTP/1.1" 200 4295 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:51 +0000] "GET /core/install.php HTTP/1.1" 200 4282 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:57 +0000] "POST /core/install.php HTTP/1.1" 302 883 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:57 +0000] "GET /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 200 3129 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:08:00 +0000] "POST /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 302 984 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:08:00 +0000] "GET /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4062 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:22:25 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4445 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:22:27 +0000] "GET /core/misc/icons/e32700/error.svg HTTP/1.1" 200 968 "http://hardrock3022c.mylabserver.com/core/themes/classy/css/components/messages.css?0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"

0 个答案:

没有答案