Official Redmine Repo - Minimal example does not work

Hi there,
i tried to deploy redmine like described here: Docker Hub
for testing i used a fresh Ubuntu22.04 VM with docker compose and copy&pasted the example

version: '3.1'

services:

  redmine:
    image: redmine
    restart: always
    ports:
      - 8080:3000
    environment:
      REDMINE_DB_MYSQL: db
      REDMINE_DB_PASSWORD: example
      REDMINE_SECRET_KEY_BASE: supersecretkey

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: redmine

in a docker-compose.yml. The containers start fine but redmine keeps restarting. The logs say:

Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Your Gemfile lists the gem puma (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it’s not a problem now, it could cause errors if you change the version of one of them later.
The Gemfile’s dependencies are satisfied
rake aborted!
ActiveRecord::ConnectionNotEstablished: Can’t connect to MySQL server on ‘db’ (110)
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:45:in rescue in new_client' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:39:in new_client’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in mysql2_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in public_send’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in checkout_new_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in try_to_checkout_new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in acquire_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in checkout' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in retrieve_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:327:in retrieve_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:283:in connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in migrate’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in block (3 levels) in <top (required)>' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in each’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>’

Caused by:
Mysql2::Error::ConnectionError: Can’t connect to MySQL server on ‘db’ (110)
/usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in connect' /usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in initialize’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in new' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in new_client’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in mysql2_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in public_send’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in checkout_new_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in try_to_checkout_new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in acquire_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in checkout' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in retrieve_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:327:in retrieve_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:283:in connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in migrate’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in block (3 levels) in <top (required)>' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in each’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>’
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Your Gemfile lists the gem puma (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it’s not a problem now, it could cause errors if you change the version of one of them later.
The Gemfile’s dependencies are satisfied

It seems redmine cant talk properly to its db? Does someone know why?
Thanks
Matthias

It should work, at least it worked for me. Are you sure the mysql container was running?

pretty sure, yes.
The db logs look like this:

docker logs
$ sudo docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS              PORTS                                       NAMES
50cefc65d058   mysql:5.7   "docker-entrypoint.s…"   7 minutes ago   Up 7 minutes        3306/tcp, 33060/tcp                         matthias_db_1
449f421f6f29   redmine     "/docker-entrypoint.…"   7 minutes ago   Up About a minute   0.0.0.0:8080->3000/tcp, :::8080->3000/tcp   matthias_redmine_1


$ sudo docker logs 50cefc65d058
2022-08-16 16:49:27+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started.
2022-08-16 16:49:27+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-16 16:49:27+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started.
2022-08-16 16:49:27+00:00 [Note] [Entrypoint]: Initializing database files
2022-08-16T16:49:27.437957Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-08-16T16:49:27.575559Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-08-16T16:49:27.608550Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-08-16T16:49:27.691937Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 642c99d3-1d83-11ed-a804-0242ac120002.
2022-08-16T16:49:27.695180Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-08-16T16:49:27.954610Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-08-16T16:49:27.954628Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-08-16T16:49:27.954957Z 0 [Warning] CA certificate ca.pem is self signed.
2022-08-16T16:49:28.002064Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2022-08-16 16:49:30+00:00 [Note] [Entrypoint]: Database files initialized
2022-08-16 16:49:30+00:00 [Note] [Entrypoint]: Starting temporary server
2022-08-16 16:49:30+00:00 [Note] [Entrypoint]: Waiting for server startup
2022-08-16T16:49:31.005844Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-08-16T16:49:31.007034Z 0 [Note] mysqld (mysqld 5.7.39) starting as process 78 ...
2022-08-16T16:49:31.009425Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-08-16T16:49:31.009442Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-08-16T16:49:31.009444Z 0 [Note] InnoDB: Uses event mutexes
2022-08-16T16:49:31.009445Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-08-16T16:49:31.009447Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2022-08-16T16:49:31.009448Z 0 [Note] InnoDB: Using Linux native AIO
2022-08-16T16:49:31.009581Z 0 [Note] InnoDB: Number of pools: 1
2022-08-16T16:49:31.009646Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-08-16T16:49:31.010983Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-08-16T16:49:31.016706Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-08-16T16:49:31.018651Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-08-16T16:49:31.030519Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2022-08-16T16:49:31.045599Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-08-16T16:49:31.045654Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-08-16T16:49:31.059660Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-08-16T16:49:31.060452Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2022-08-16T16:49:31.060469Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2022-08-16T16:49:31.060908Z 0 [Note] InnoDB: 5.7.39 started; log sequence number 2754908
2022-08-16T16:49:31.061100Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-08-16T16:49:31.061224Z 0 [Note] Plugin 'FEDERATED' is disabled.
2022-08-16T16:49:31.062839Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220816 16:49:31
2022-08-16T16:49:31.066423Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2022-08-16T16:49:31.066439Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2022-08-16T16:49:31.066441Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-08-16T16:49:31.066442Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-08-16T16:49:31.066806Z 0 [Warning] CA certificate ca.pem is self signed.
2022-08-16T16:49:31.066833Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2022-08-16T16:49:31.070239Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2022-08-16T16:49:31.074674Z 0 [Note] Event Scheduler: Loaded 0 events
2022-08-16T16:49:31.074854Z 0 [Note] mysqld: ready for connections.
Version: '5.7.39'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
2022-08-16 16:49:31+00:00 [Note] [Entrypoint]: Temporary server started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2022-08-16 16:49:32+00:00 [Note] [Entrypoint]: Creating database redmine

2022-08-16 16:49:33+00:00 [Note] [Entrypoint]: Stopping temporary server
2022-08-16T16:49:33.007872Z 0 [Note] Giving 0 client threads a chance to die gracefully
2022-08-16T16:49:33.007892Z 0 [Note] Shutting down slave threads
2022-08-16T16:49:33.007898Z 0 [Note] Forcefully disconnecting 0 remaining clients
2022-08-16T16:49:33.007902Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2022-08-16T16:49:33.007931Z 0 [Note] Binlog end
2022-08-16T16:49:33.008369Z 0 [Note] Shutting down plugin 'ngram'
2022-08-16T16:49:33.008378Z 0 [Note] Shutting down plugin 'partition'
2022-08-16T16:49:33.008380Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2022-08-16T16:49:33.008382Z 0 [Note] Shutting down plugin 'ARCHIVE'
2022-08-16T16:49:33.008383Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2022-08-16T16:49:33.008412Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2022-08-16T16:49:33.008436Z 0 [Note] Shutting down plugin 'MyISAM'
2022-08-16T16:49:33.008444Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2022-08-16T16:49:33.008445Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2022-08-16T16:49:33.008446Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2022-08-16T16:49:33.008447Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2022-08-16T16:49:33.008448Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2022-08-16T16:49:33.008449Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2022-08-16T16:49:33.008450Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2022-08-16T16:49:33.008450Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2022-08-16T16:49:33.008451Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2022-08-16T16:49:33.008452Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2022-08-16T16:49:33.008452Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2022-08-16T16:49:33.008453Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2022-08-16T16:49:33.008454Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2022-08-16T16:49:33.008455Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2022-08-16T16:49:33.008456Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2022-08-16T16:49:33.008456Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2022-08-16T16:49:33.008458Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2022-08-16T16:49:33.008458Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2022-08-16T16:49:33.008459Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2022-08-16T16:49:33.008460Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2022-08-16T16:49:33.008461Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2022-08-16T16:49:33.008462Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2022-08-16T16:49:33.008463Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2022-08-16T16:49:33.008464Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2022-08-16T16:49:33.008465Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2022-08-16T16:49:33.008465Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2022-08-16T16:49:33.008466Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2022-08-16T16:49:33.008467Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2022-08-16T16:49:33.008468Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2022-08-16T16:49:33.008468Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2022-08-16T16:49:33.008469Z 0 [Note] Shutting down plugin 'InnoDB'
2022-08-16T16:49:33.008504Z 0 [Note] InnoDB: FTS optimize thread exiting.
2022-08-16T16:49:33.008578Z 0 [Note] InnoDB: Starting shutdown...
2022-08-16T16:49:33.109288Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2022-08-16T16:49:33.109643Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 220816 16:49:33
2022-08-16T16:49:34.292735Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12140735
2022-08-16T16:49:34.293659Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2022-08-16T16:49:34.293674Z 0 [Note] Shutting down plugin 'MEMORY'
2022-08-16T16:49:34.293678Z 0 [Note] Shutting down plugin 'CSV'
2022-08-16T16:49:34.293684Z 0 [Note] Shutting down plugin 'sha256_password'
2022-08-16T16:49:34.293686Z 0 [Note] Shutting down plugin 'mysql_native_password'
2022-08-16T16:49:34.293791Z 0 [Note] Shutting down plugin 'binlog'
2022-08-16T16:49:34.294180Z 0 [Note] mysqld: Shutdown complete

2022-08-16 16:49:35+00:00 [Note] [Entrypoint]: Temporary server stopped

2022-08-16 16:49:35+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.

2022-08-16T16:49:35.190221Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-08-16T16:49:35.191229Z 0 [Note] mysqld (mysqld 5.7.39) starting as process 1 ...
2022-08-16T16:49:35.193655Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-08-16T16:49:35.193673Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-08-16T16:49:35.193675Z 0 [Note] InnoDB: Uses event mutexes
2022-08-16T16:49:35.193677Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-08-16T16:49:35.193678Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2022-08-16T16:49:35.193686Z 0 [Note] InnoDB: Using Linux native AIO
2022-08-16T16:49:35.193843Z 0 [Note] InnoDB: Number of pools: 1
2022-08-16T16:49:35.193912Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-08-16T16:49:35.194869Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-08-16T16:49:35.199369Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-08-16T16:49:35.200559Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-08-16T16:49:35.215096Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2022-08-16T16:49:35.231163Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-08-16T16:49:35.231220Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-08-16T16:49:35.243654Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-08-16T16:49:35.244249Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2022-08-16T16:49:35.244262Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2022-08-16T16:49:35.244569Z 0 [Note] InnoDB: 5.7.39 started; log sequence number 12140735
2022-08-16T16:49:35.244664Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-08-16T16:49:35.244781Z 0 [Note] Plugin 'FEDERATED' is disabled.
2022-08-16T16:49:35.247223Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220816 16:49:35
2022-08-16T16:49:35.248297Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2022-08-16T16:49:35.248312Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2022-08-16T16:49:35.248315Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-08-16T16:49:35.248316Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-08-16T16:49:35.248681Z 0 [Warning] CA certificate ca.pem is self signed.
2022-08-16T16:49:35.248708Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2022-08-16T16:49:35.248885Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2022-08-16T16:49:35.248921Z 0 [Note] IPv6 is available.
2022-08-16T16:49:35.248933Z 0 [Note]   - '::' resolves to '::';
2022-08-16T16:49:35.248942Z 0 [Note] Server socket created on IP: '::'.
2022-08-16T16:49:35.251950Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2022-08-16T16:49:35.256522Z 0 [Note] Event Scheduler: Loaded 0 events
2022-08-16T16:49:35.256693Z 0 [Note] mysqld: ready for connections.
Version: '5.7.39'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

to sum it up: 2022-08-16T16:49:35.256693Z 0 [Note] mysqld: ready for connections.

Then try to stop UFW or any firewall you have temporarily. Or if you don’t want to stop, check if you have a running firewall and try to configure it. I know, UFW can have similar effects, but I don’t remember any problem on my Ubuntu 22.04 and now I only tried it on my Mac.

$ sudo ufw status
Status: inactive

ufw is disabled, and no other firewall is enabled either.

How did you installed Docker?

Docker install:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable --now docker

It would work on a brand new Ubuntu 22.04 installation. I tried it now in a VM. Since it doesn’t work for you and you also created the VM for Docker, the next question is how. So how did you create the VM? I just tried with multipass on my Mac. You should also check if the IP address of your VM is in the same IP range as the container, but I don’t think that is the case, because that would only be a problem if you ran the containers, rebooted the VM and ran the containers again after the ip of your VM changed.

So I don’t know what the problem is, but is must be something with the environment, because Docker Compose should have worked in that VM as it worked in mine.

THe VM is a VIrtualbox.
Just to clarify, docker compose works but the redmine container seems unable to connect to the db and keeps restarting after about 2 minutes.

$ sudo docker-compose down -v
Stopping matthias_db_1      ... done
Stopping matthias_redmine_1 ... done
Removing matthias_db_1      ... done
Removing matthias_redmine_1 ... done
Removing network matthias_default

$ sudo docker-compose up -d
Creating network "matthias_default" with the default driver
Creating matthias_db_1      ... done
Creating matthias_redmine_1 ... done

$ sudo docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED          STATUS          PORTS                                       NAMES
ae646ba76f82   redmine     "/docker-entrypoint.…"   17 seconds ago   Up 16 seconds   0.0.0.0:8080->3000/tcp, :::8080->3000/tcp   matthias_redmine_1
dc2b2dfacaa6   mysql:5.7   "docker-entrypoint.s…"   17 seconds ago   Up 15 seconds   3306/tcp, 33060/tcp                         matthias_db_1

$ sudo docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED              STATUS          PORTS                                       NAMES
ae646ba76f82   redmine     "/docker-entrypoint.…"   About a minute ago   Up 59 seconds   0.0.0.0:8080->3000/tcp, :::8080->3000/tcp   matthias_redmine_1
dc2b2dfacaa6   mysql:5.7   "docker-entrypoint.s…"   About a minute ago   Up 58 seconds   3306/tcp, 33060/tcp                         matthias_db_1

$ sudo docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED              STATUS              PORTS                                       NAMES
ae646ba76f82   redmine     "/docker-entrypoint.…"   About a minute ago   Up About a minute   0.0.0.0:8080->3000/tcp, :::8080->3000/tcp   matthias_redmine_1
dc2b2dfacaa6   mysql:5.7   "docker-entrypoint.s…"   About a minute ago   Up About a minute   3306/tcp, 33060/tcp                         matthias_db_1

$ sudo docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS              PORTS                                       NAMES
ae646ba76f82   redmine     "/docker-entrypoint.…"   3 minutes ago   Up About a minute   0.0.0.0:8080->3000/tcp, :::8080->3000/tcp   matthias_redmine_1
dc2b2dfacaa6   mysql:5.7   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes        3306/tcp, 33060/tcp                         matthias_db_1

$ sudo docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS         PORTS                                       NAMES
ae646ba76f82   redmine     "/docker-entrypoint.…"   4 minutes ago   Up 2 minutes   0.0.0.0:8080->3000/tcp, :::8080->3000/tcp   matthias_redmine_1
dc2b2dfacaa6   mysql:5.7   "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes   3306/tcp, 33060/tcp                         matthias_db_1

$ sudo docker logs ae646ba76f82
redmine logs Your Gemfile lists the gem puma (>= 0) more than once. You should probably keep only one of them. Remove any duplicate entries and specify the gem only once. While it's not a problem now, it could cause errors if you change the version of one of them later. The Gemfile's dependencies are satisfied rake aborted! ActiveRecord::ConnectionNotEstablished: Can't connect to MySQL server on 'db' (110) /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:45:in `rescue in new_client' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:39:in `new_client' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in `mysql2_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:327:in `retrieve_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:283:in `connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in ' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `each' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in '

Caused by:
Mysql2::Error::ConnectionError: Can’t connect to MySQL server on ‘db’ (110)
/usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in connect' /usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in initialize’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in new' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in new_client’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in mysql2_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in public_send’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in checkout_new_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in try_to_checkout_new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in acquire_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in checkout' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in retrieve_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:327:in retrieve_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:283:in connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in migrate’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in block (3 levels) in <top (required)>' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in each’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in block (2 levels) in <top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace) Your Gemfile lists the gem puma (>= 0) more than once. You should probably keep only one of them. Remove any duplicate entries and specify the gem only once. While it's not a problem now, it could cause errors if you change the version of one of them later. The Gemfile's dependencies are satisfied rake aborted! ActiveRecord::ConnectionNotEstablished: Can't connect to MySQL server on 'db' (110) /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:45:in rescue in new_client’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:39:in new_client' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in mysql2_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in public_send' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in new_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in checkout_new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in try_to_checkout_new_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in acquire_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in checkout’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in retrieve_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:327:in retrieve_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:283:in connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in migrate' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in block (3 levels) in <top (required)>’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in each' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in block (2 levels) in <top (required)>’

Caused by:
Mysql2::Error::ConnectionError: Can’t connect to MySQL server on ‘db’ (110)
/usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in connect' /usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in initialize’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in new' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in new_client’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in mysql2_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in public_send’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in checkout_new_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in try_to_checkout_new_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in acquire_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in checkout' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in retrieve_connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:327:in retrieve_connection’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/connection_handling.rb:283:in connection' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in migrate’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in block (3 levels) in <top (required)>' /usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in each’
/usr/local/bundle/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>’
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Your Gemfile lists the gem puma (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it’s not a problem now, it could cause errors if you change the version of one of them later.
The Gemfile’s dependencies are satisfied

How do i check for an IP conflict?

I spun up another VM and there it does now work flawlessly. But i dont know what i changed…
sorry for the trouble.