2

Just finished setting up immich on my server. Using the prepared docker compose file. But I renamed the docker image of the database. It was called postgres. I renamed it to immich_postgres. After all, I want to know that this container belongs to immich.

Half an hour troubleshooting later, I figured out why I get a login failed error message. Login did not fail, connection did. Why? Because, they rely on the postgres name as an alias. They could have put an explicit alias for dns, they could have used the configuration name, after all they used it in the depends_on section. But they decided to refer to it via the automatically assigned name. Really? Container name? That one thing in the configuration that is supposed to be unique?

Did you really think that was the only postgres database on the server? Maybe I should centralize it into a single database, but I like when my applications can run without outside dependencies. Proper documentation would have been nice. I am sure they mention it somewhere.

Comments
  • 0
    That name of the service is the name of the hostname afaik. container_name can be deleted in general I guess. The depens_on works with the service name I guess. You can keep service name just progress and run multiple instances. Or maybe I really don't understand.

    This is my configuration of a test project and it doesn't have container name at all. gogs-db is the hostname of the container and it's not a problem to have that in compose configs.
  • 1
    @retoor

    I think you do not understand.

    I used immich. immich had a container name preset "postgres" for its postgres database. It also had service name preset "database".

    Somewhere inside of immich it has a database string that defaulted to: DATABASE_URL=http:////

    I said, this is a stupid default. It means just one postgres db on it. They could have used the service name, that wouldn't have these limitations.

    DATABASE_URL=http:////

    It is in the "depends_on", service name would be recognized. Don't set a container name this generic as a default anyway, it has to be unique. Just leave it away and use the service name as a default. That would have been just fine.

    But that was what immich did and it is a pain in the arse to debug someone's docker setup when it is not documented right, hence the rant.
Add Comment