Docker redmine instance intermittently returns error 500


I am hosting a docker container of a Redmine instance and MySQL database, deployed from a docker compose. Here’s my docker-compose.yml:

version: '3.1'

    image: redmine:5.0.5
    restart: always
    # ports:
    #    - 8080:3000 #if you want to test without the proxy
      - proxy
      - db
      VIRTUAL_HOST: ******.*****.****


    image: mysql:5.7
      MYSQL_DATABASE: redmine
    restart: unless-stopped

    name: nginx_network

This manages to start up, but after a while if I try to load the website I will get a 500 internal service error like so:

#on redmine container log
F, [2023-08-07T20:59:46.870179 #1] FATAL -- :   

ActiveRecord::ConnectionNotEstablished (Access denied for user 'root'@'**.**.**.**' (using password: YES)):


app/models/setting.rb:280:in `check_cache'

app/controllers/application_controller.rb:102:in `user_setup'

#on website
Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.


Generally if I refresh the page a couple of times it starts working again. Sometimes the issue doesn’t come up.
There’s nothing configured other than the docker compose, the container is connected to a network using Nginx proxy manager which manages the website hosting.

Is there a change I could make in the docker compose which would stop this from happening? It seems like the host just needs to wait a short time or something, since refreshing the page usually fixes the problem.
Apologies for any obvious mistakes, i’m new to docker.

The error looks like a database connection error.

These issues can happen when you have another service on the same docker network with the same service name as the db in the compose file. That way Redmine would sometimes connect to the right database and sometimes not. You need unique service names on a common network or use additional network aliases instead of the service names.

Thanks, I changed the name of the DB service and it appears to be fixed :slight_smile: