Docker 和 postgresql: 服务器意外关闭连接 (MacOS Catalina)

Docker and postgresql: server closed the connection unexpectedly (MacOS Catalina)

我有一个简单的本地环境,其中包括 docker-compose:

version: '3'

services:

  postgres-mydb:
    image: 'postgres:11-alpine'
    ports:
      - "5433:5432"
    volumes:
      - ./pg_data:/var/lib/postgresql
    environment:
      POSTGRES_DB: docker_mydb_dev
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password

最近当我尝试连接到数据库时:

psql postgresql://user:password@localhost:5433/docker_mydb_dev

我得到:

psql: error: could not connect to server: server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

我很困惑,我在网上找不到任何想法。

好吧 - 解决这个问题 - 我无法访问我的数据库(docker 或不)的原因是我被要求在我的计算机上安装防火墙并且它阻止了对本地主机的访问。现在一切正常。

感谢您的帮助!