在进行wagtail学习的时候,我想要通过容器将后端与数据库分离,因此使用了Docker对postgres进行单独搭建。
搭建过程中报错:
Unable to connect to server: connection to server at “localhost”(127.0.0.1),port 6700 failed;Connection refused is the server running on that host and accepting TCP/IP connections?connection to server at “localhost”(::1),port 6700 failed;Address not available is the server running on that host and accepting TCP/IP connections?
错误复现
创建postgres容器时,我通过命令行:
docker run -itd --name postgresdb -e POSTGRES_PASSWORD=123456 -p 5432:5432 postgres
而后在pgAdmin或者wagtail中进行配置:
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': '123456',
'HOST': '127.0