Welcome to the Linux Foundation Forum!

Postgres errors in 10. Continuous Delivery to Dev with Docker Compose

My app failed to work properly with the suggested postgres:9.4 image and docker-compose.yaml.

docker-compose logs db for the error:

Error: Database is uninitialized and superuser password is not specified.
db_1      |        You must specify POSTGRES_PASSWORD for the superuser. Use
db_1      |        "-e POSTGRES_PASSWORD=password" to set it in "docker run".
db_1      | 
db_1      |        You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections
db_1      |        without a password. This is *not* recommended. See PostgreSQL
db_1      |        documentation about "trust":
db_1      |        https://www.postgresql.org/docs/current/auth-trust.html

Add environment variable:

  db:
    image: postgres:9.4
    environment:
      POSTGRES_HOST_AUTH_METHOD: trust
...

:innocent: All better :innocent:

Comments

  • postgres image has been recently updated and now requires a environment variable. You could use either of the following.

    1. POSTGRES_HOST_AUTH_METHOD: trust
    2. POSTGRES_PASSWORD=password

    I would update the instructions/code accordingly.

  • lbono
    lbono Posts: 1

    You should also do docker-compose down to clean up, and then recreate with docker-compose up -d to make it work.

    Regards.-

  • tomp736
    tomp736 Posts: 5
    edited December 2021

    Can you please update the course content, I spent more time that I would have liked trying to get this to work, when it was as simple as adding an entry to env.

    ** turns out the next video went over this

    I like to follow along, and when the video shows that the setup works I pause and try to get it working myself.

  • Hi @tomp736 , we are updating the course content in batches. So in the next update we'll make sure to include this one.

    Also, please know that the DevOps world is changing very fast in terms of the technical stuff. We have seen this in various things, so be aware of this.

    Many regards,
    Luis.

Categories

Upcoming Training