Docker 桌面 (Windows 10) 问题与 Postgres 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-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(上,即使没有最后一行- POSTGRES_HOST_AUTH_METHOD=trust,也可以正常工作

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

Docker 桌面是最新版本以及 docker-compose 命令

密码中的单引号也作为密码的一部分

version: '3'
services:
postgres:
image: postgres:latest
environment:
- POSTGRES_PASSWORD=somepassword
- POSTGRES_HOST_AUTH_METHOD=trust

最新更新