简体   繁体   English

Docker 桌面(Windows 10)问题与 Postgres docker-compose

[英]Docker desktop (Windows 10) issue with Postgres docker-compose

On Docker Desktop (Windows 10), i'm unable to start postgres container with docker-compose在 Docker 桌面(Windows 10)上,我无法使用docker-compose启动 postgres 容器

version: '3'
services:

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

Getting error that password is not set:收到未设置密码的错误:

$ 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

However, on Linux (CentOS 8) all works fine, even without last line - POSTGRES_HOST_AUTH_METHOD=trust但是,在 Linux (CentOS 8) 上一切正常,即使没有最后一行- POSTGRES_HOST_AUTH_METHOD=trust

Has anyone experienced same issue on Windows 10?有人在 Windows 10 上遇到过同样的问题吗?

Docker desktop is on latest version as well as docker-compose command Docker 桌面是最新版本以及 docker-compose 命令

The single quote in your password is also going as a part of password密码中的单引号也作为密码的一部分

version: '3'
services:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM