Database keycloak does not exist, postgres

I am using a docker compose file to spin up the different service instances for the project I am working on, including the redis, postgres (to be used by the app and keycloak), and keycloak servers, along with the base app itself. Unfortunately, when I bring it all up, keycloak is unable to find it’s database unless I set the database AND schema to public, which is not ideal.

the specific error is either

postgres_1       | 2020-08-22 06:21:37.473 UTC [33] FATAL:  database "keycloak" does not exist

when I have the following in my docker-compose.yaml (showing only environment for brevity)

postgres:
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=admin
      - POSTGRES_PASSWORD=password
      - PGDATA=/var/lib/postgresql/data/pgdata
  keycloak:
    environment:
      KEYCLOAK_USER: admin
      KEYCLOAK_PASSWORD: password
      DB_VENDOR: POSTGRES
      DB_USER: admin
      DB_PASSWORD: password
      DB_DATABASE: keycloak
      DB_SCHEMA: public #or 'keycloak'
      DB_ADDR: postgres

and I get (repeated MANY times)

postgres_1       | 2020-08-22 06:44:11.015 UTC [34] ERROR:  relation "keycloak.databasechangeloglock" does not exist at character 22
postgres_1       | 2020-08-22 06:44:11.015 UTC [34] STATEMENT:  select count(*) from keycloak.databasechangeloglock
postgres_1       | 2020-08-22 06:44:11.022 UTC [34] ERROR:  schema "keycloak" does not exist at character 14
postgres_1       | 2020-08-22 06:44:11.022 UTC [34] STATEMENT:  CREATE TABLE keycloak.databasechangeloglock (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP WITHOUT TIME ZONE, LOCKEDBY VARCHAR(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
keycloak_1       | 06:44:11,022 WARN  [org.keycloak.connections.jpa.updater.liquibase.lock.CustomLockService] (ServerService Thread Pool -- 60) Failed to create lock table. Maybe other transaction created in the meantime. Retrying...

when I use

      DB_DATABASE: public
      DB_SCHEMA: keycloak

The former situation would be the most ideal, as I would like to be able to put the keycloak on it’s own database, but understanding why both situations are currently broken is important so that I can solve this problem in the future if it pops up again.

the entire docker-compse.yaml file should it be needed

version: "3"
services:
  pollster: #the main app
    image: "pollster" 
    ports:
      - "4201:4201"
    volumes:
      - "./properties.compose.json:/properties.json"
    depends_on:
      - redis_wait
      - postgres_wait
      - keycloak_wait

  redis:
    image: "redis"
  redis_wait:
    image: dadarek/wait-for-dependencies
    depends_on:
      - redis
    command: redis:6379

  postgres:
    image: "postgres"
    ports:
      - "5433:5432"
    environment:
      - POSTGRES_DB=public
      - POSTGRES_USER=admin
      - POSTGRES_PASSWORD=password
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      - "postgres_data:/var/lib/postgresql/data/pgdata"
    #command: ["postgres", "-c", "log_statement=all"] #Log All Postgres Queries.
  postgres_wait:
    image: dadarek/wait-for-dependencies
    depends_on:
      - postgres
    command: postgres:5432

  keycloak:
    image: "jboss/keycloak"
    depends_on:
      - postgres_wait
    ports:
      - "8080:8080"
    environment:
      KEYCLOAK_USER: admin
      KEYCLOAK_PASSWORD: password
      DB_VENDOR: POSTGRES

      DB_USER: admin
      DB_PASSWORD: password
      DB_DATABASE: public
      DB_SCHEMA: keycloak
      DB_ADDR: postgres

    volumes:
      - "keycloak_data:/keycloak"
  keycloak_wait:
    image: dadarek/wait-for-dependencies
    depends_on:
      - keycloak
    command: keycloak:8080

volumes:
  postgres_data:
    driver: local
  keycloak_data:
    driver: local