1

On Docker Desktop (Windows 10), i'm unable to start postgres container with docker-compose

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

Has anyone experienced same issue on Windows 10 ?

Docker desktop is on latest version as well as docker-compose command

1
  • Try adding double quotes around your password. Or even the entire declaration. i.e. "POSTGRES_PASSWORD=somepassword" Commented May 13, 2020 at 12:44

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.