Postgresql Docker桌面(Windows 10)出现Postgres Docker compose问题

Postgresql Docker桌面(Windows 10)出现Postgres Docker compose问题,postgresql,docker,docker-compose,Postgresql,Docker,Docker Compose,在Docker桌面(Windows 10)上,我无法使用Docker compose启动postgres容器 version: '3' services: postgres: image: postgres:latest environment: - POSTGRES_PASSWORD='somepassword' - POSTGRES_HOST_AUTH_METHOD=trust 获取未设置密码的错误信息: $ docker-compos

在Docker桌面(Windows 10)上,我无法使用
Docker compose启动postgres容器

version: '3'
services:

  postgres:
     image: postgres:latest
     environment:
       - POSTGRES_PASSWORD='somepassword'
       - POSTGRES_HOST_AUTH_METHOD=trust
获取未设置密码的错误信息:

$ docker-compose up --build
Starting complex_postgres_1 ... done
Attaching to complex_postgres_1
postgres_1  | Error: Database is uninitialized and superuser password is not specified.
postgres_1  |        You must specify POSTGRES_PASSWORD to a non-empty value for the
postgres_1  |        superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
postgres_1  | 
postgres_1  |        You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
postgres_1  |        connections without a password. This is *not* recommended.
postgres_1  |
postgres_1  |        See PostgreSQL documentation about "trust":
postgres_1  |        https://www.postgresql.org/docs/current/auth-trust.html
complex_postgres_1 exited with code 1
但是,在Linux(CentOS 8)上,即使没有最后一行代码,所有操作都可以正常运行

有没有人在Windows 10上遇到过同样的问题


Docker desktop是最新版本,Docker compose命令也是最新版本

密码中的单引号也是密码的一部分

version: '3'
services:

  postgres:
     image: postgres:latest
     environment:
       - POSTGRES_PASSWORD=somepassword
       - POSTGRES_HOST_AUTH_METHOD=trust

尝试在密码周围添加双引号。甚至是整个宣言。i、 e.
“POSTGRES\u PASSWORD=somepassword”