4
b2plane
1y

PLEASE

Im trying to start keycloak via docker compose

It works when i start the container via docker

But fucking fails when docker compose SAME.EXACT COMMAND

Keeps crashing with logs

2023-10-13 11:34:40 User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'

WHY

Comments
  • 2
    IMMEDIATELY AS SOON AS I FUCKING POSTED THIS RANT I TRIED ADDING 1 MORE LINE OF CODE AND NOW IT FUCKING SOMEHOW WORKED FOR SOME FUCKING REASON AND I DONT UNDERSTAND WHY IT FUCKING WORKS
  • 1
    @ostream BRO
  • 0
    @ostream NO I DONT BELIEVE IT WORKS. LET ME TRY TO CHANGE SOME SHIT AND SEE IF IT STILL WORKS
  • 0
    @ostream doesnt work

    But now i know whats causing it

    But i dont know how to fix it yet

    Basicay mounting a volume on postgres container makes the keycloak container fail to boot with that error message

    NOT mounting a volume on postgres container makes the microservice fail to boot because it cant connect to the postgres db.

    ....
  • 1
    @ostream brainwreck bro

    I think i fixed this bullshit

    Now both keycloak postgres and microservice work

    Chatgpt is my Lord 🙏🙏🙏🙏🙏🙏🙏🙏☦️☦️☦️☦️☦️✝️✝️✝️✝️
  • 1
    @ostream please explain me why the FUCK does this fix the issue:

    ✅:

    ...
    postgres:
    ...
    volumes:
    - postgres-data:/data/postgres
    ...
    ...

    volumes:
    postgres-data:

    ❌:

    ...
    postgres:
    ...
    volumes:
    - db:/data/postgres
    ...
    ...

    volumes:
    db:

    ---

    ?????
  • 0
    @ostream hmmmm...i dont think so
  • 2
    When you mount an existing volume, that already contains an admin user, you can't add an admin user.

    When you change the volume name, you create a new clean one.

    Your containers are assuming they are starting with fresh volumes. To validate this, retry with db. I bet it worked the first time and fails every other time.
  • 0
    OR... If it is building that json dynamically from the database on startup, and you are persisting both with volumes, it could be trying to generate a file that's already generated.

    Do you persist that config folder or json file as well?
  • 0
    @lungdart no. keycloak creates it successfully as soon as it starts and then after 10 seconds of booting up it appears it tries adding it again causing the bug and crashes leading the container to fail to boot up. Only when i put postgres-data as root mnt volume it works

    Thats 1 out of 4 pieces that solved this problem. But thats the biggest one
  • 1
    You're explanation doesn't line up with the configuration you've given.

    I have a few minutes, if you want to post a link to the full working docker commands and failing docker compose yaml.
  • 0
    It's highly likely that the volume just contained something that caused the error. Have you ever tried to delete it between runs?
Add Comment