docker-library / redmine

Docker Official Image packaging for Redmine
GNU General Public License v2.0
211 stars 173 forks source link

podman-compose - Mysql2::Error::ConnectionError: Unknown server host 'db' (-2) #308

Closed D3vil0p3r closed 11 months ago

D3vil0p3r commented 11 months ago

I'm using podman (4.8.0) on my Debian 11 endpoint and using podman-compose (1.0.6) to implement the redmine compose file described in RedMine official guide in Docker Hub:

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

For running this in Debian, I need also to install appstream and slirp4netns packages to prevent warning/error messages (so I guess they must be documented on your guide in case of podman usage).

When I run podman-compose up -d, I get:

podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.8.0
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=athena', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
['podman', 'network', 'exists', 'athena_default']
['podman', 'network', 'create', '--label', 'io.podman.compose.project=athena', '--label', 'com.docker.compose.project=athena', 'athena_default']
['podman', 'network', 'exists', 'athena_default']
podman run --name=athena_redmine_1 -d --label io.podman.compose.config-hash=b93f694d7fbe1935350defa8dda75ebdee1cd3d09ccc1a06f2d930071baaa22c --label io.podman.compose.project=athena --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@athena.service --label com.docker.compose.project=athena --label com.docker.compose.project.working_dir=/home/athena --label com.docker.compose.project.config_files=podman-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=redmine -e REDMINE_DB_MYSQL=db -e REDMINE_DB_PASSWORD=example -e REDMINE_SECRET_KEY_BASE=supersecretkey --net athena_default --network-alias redmine -p 8080:3000 --restart always redmine
Resolving "redmine" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/library/redmine:latest...
Getting image source signatures
Copying blob f119cfdb2fe1 done   | 
Copying blob 032f78a9a8d5 done   | 
Copying blob 1f7ce2fa46ab done   | 
Copying blob 6abe30ec3479 done   | 
Copying blob 49e36bd6cba5 done   | 
Copying blob e87ef05cb8dc done   | 
Copying blob 89fb2e492280 done   | 
Copying blob 54e1525498ff done   | 
Copying blob 223755aae0ed done   | 
Copying blob 89d86f1a9e88 done   | 
Copying blob 3d9f5e417573 done   | 
Copying blob f65246640780 done   | 
Copying config 402ee5eeea done   | 
Writing manifest to image destination
fab7f14286e5cf6d8b80a4644ebf363a8a29d047c5bff57ff10a57317a298d04
exit code: 0
['podman', 'network', 'exists', 'athena_default']
podman run --name=athena_db_1 -d --label io.podman.compose.config-hash=b93f694d7fbe1935350defa8dda75ebdee1cd3d09ccc1a06f2d930071baaa22c --label io.podman.compose.project=athena --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@athena.service --label com.docker.compose.project=athena --label com.docker.compose.project.working_dir=/home/athena --label com.docker.compose.project.config_files=podman-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=db -e MYSQL_ROOT_PASSWORD=example -e MYSQL_DATABASE=redmine --net athena_default --network-alias db --restart always mysql:5.7
Resolving "mysql" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/library/mysql:5.7...
Getting image source signatures
Copying blob 62aca7179a54 done   | 
Copying blob 11a38aebcb7a done   | 
Copying blob 91ab01309bd6 done   | 
Copying blob 6c91fabb88c2 done   | 
Copying blob 8f46e806ab5c done   | 
Copying blob 29f5af1d1661 done   | 
Copying blob 85023e6de3be done   | 
Copying blob 6d5934a87cbb done   | 
Copying blob c878502d3f70 done   | 
Copying blob 4756467c684a done   | 
Copying blob ee9043dd2677 done   | 
Copying config bdba757bc9 done   | 
Writing manifest to image destination
4ef41ebf7fb865aabb45cee9b0913e89422ca6fab8a8cd9518067f9661062e0e
exit code: 0

So, no error. Indeed, if I run podman ps, I see the running containers:

fab7f14286e5  docker.io/library/redmine:latest  rails server -b 0...  48 seconds ago  Up Less than a second  0.0.0.0:8080->3000/tcp  athena_redmine_1
4ef41ebf7fb8  docker.io/library/mysql:5.7       mysqld                35 seconds ago  Up 35 seconds                                  athena_db_1

The problem is: when I try to access to the 8080 port of my host, for example by curl, I get "[connection reset](curl: (56) Recv failure: Connection reset by peer)" message. The 8080 TCP port is reachable, I tested it by nmap.

By checking podman logs athena_db_1 I get no errors:

2023-12-05 22:33:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2023-12-05 22:33:35+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-12-05 22:33:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2023-12-05 22:33:36+00:00 [Note] [Entrypoint]: Initializing database files
2023-12-05T22:33:36.110025Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-05T22:33:36.432046Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-12-05T22:33:36.488587Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-12-05T22:33:36.551031Z 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: 547b7424-93be-11ee-bc61-9ad542aad4ed.
2023-12-05T22:33:36.552467Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-12-05T22:33:36.691816Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-12-05T22:33:36.691889Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-12-05T22:33:36.692353Z 0 [Warning] CA certificate ca.pem is self signed.
2023-12-05T22:33:36.696785Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2023-12-05 22:33:39+00:00 [Note] [Entrypoint]: Database files initialized
2023-12-05 22:33:39+00:00 [Note] [Entrypoint]: Starting temporary server
2023-12-05 22:33:39+00:00 [Note] [Entrypoint]: Waiting for server startup
2023-12-05T22:33:39.389736Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-05T22:33:39.391076Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 125 ...
2023-12-05T22:33:39.394535Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-12-05T22:33:39.394599Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-12-05T22:33:39.394626Z 0 [Note] InnoDB: Uses event mutexes
2023-12-05T22:33:39.394657Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-12-05T22:33:39.394682Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-12-05T22:33:39.394711Z 0 [Note] InnoDB: Using Linux native AIO
2023-12-05T22:33:39.394982Z 0 [Note] InnoDB: Number of pools: 1
2023-12-05T22:33:39.395159Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-12-05T22:33:39.397307Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-12-05T22:33:39.406040Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-05T22:33:39.407985Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-12-05T22:33:39.419266Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-12-05T22:33:39.427729Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-12-05T22:33:39.427805Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-12-05T22:33:39.450919Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-12-05T22:33:39.451630Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-12-05T22:33:39.451678Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-12-05T22:33:39.453531Z 0 [Note] InnoDB: Waiting for purge to start
2023-12-05T22:33:39.503727Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 2768291
2023-12-05T22:33:39.503902Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-12-05T22:33:39.505646Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-12-05T22:33:39.507387Z 0 [Note] InnoDB: Buffer pool(s) load completed at 231205 22:33:39
2023-12-05T22:33:39.511733Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-12-05T22:33:39.511750Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-12-05T22:33:39.511755Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-12-05T22:33:39.511757Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-12-05T22:33:39.512260Z 0 [Warning] CA certificate ca.pem is self signed.
2023-12-05T22:33:39.512329Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-12-05T22:33:39.515942Z 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.
2023-12-05T22:33:39.522458Z 0 [Note] Event Scheduler: Loaded 0 events
2023-12-05T22:33:39.522698Z 0 [Note] mysqld: ready for connections.
Version: '5.7.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
2023-12-05 22:33:40+00:00 [Note] [Entrypoint]: Temporary server started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2023-12-05T22:33:40.307009Z 3 [Note] InnoDB: Stopping purge
2023-12-05T22:33:40.313226Z 3 [Note] InnoDB: Resuming purge
2023-12-05T22:33:40.316653Z 3 [Note] InnoDB: Stopping purge
2023-12-05T22:33:40.318984Z 3 [Note] InnoDB: Resuming purge
2023-12-05T22:33:40.320140Z 3 [Note] InnoDB: Stopping purge
2023-12-05T22:33:40.322059Z 3 [Note] InnoDB: Resuming purge
2023-12-05T22:33:40.322584Z 3 [Note] InnoDB: Stopping purge
2023-12-05T22:33:40.327008Z 3 [Note] InnoDB: Resuming purge
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.
2023-12-05 22:33:42+00:00 [Note] [Entrypoint]: Creating database redmine

2023-12-05 22:33:42+00:00 [Note] [Entrypoint]: Stopping temporary server
2023-12-05T22:33:42.112037Z 0 [Note] Giving 0 client threads a chance to die gracefully
2023-12-05T22:33:42.112065Z 0 [Note] Shutting down slave threads
2023-12-05T22:33:42.112071Z 0 [Note] Forcefully disconnecting 0 remaining clients
2023-12-05T22:33:42.112078Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2023-12-05T22:33:42.112131Z 0 [Note] Binlog end
2023-12-05T22:33:42.112620Z 0 [Note] Shutting down plugin 'ngram'
2023-12-05T22:33:42.112632Z 0 [Note] Shutting down plugin 'partition'
2023-12-05T22:33:42.112636Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2023-12-05T22:33:42.112640Z 0 [Note] Shutting down plugin 'ARCHIVE'
2023-12-05T22:33:42.112642Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2023-12-05T22:33:42.112678Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2023-12-05T22:33:42.112687Z 0 [Note] Shutting down plugin 'MyISAM'
2023-12-05T22:33:42.112697Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2023-12-05T22:33:42.112701Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2023-12-05T22:33:42.112704Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2023-12-05T22:33:42.112706Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2023-12-05T22:33:42.112709Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2023-12-05T22:33:42.112711Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2023-12-05T22:33:42.112712Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2023-12-05T22:33:42.112714Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2023-12-05T22:33:42.112715Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2023-12-05T22:33:42.112716Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2023-12-05T22:33:42.112718Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2023-12-05T22:33:42.112719Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2023-12-05T22:33:42.112720Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2023-12-05T22:33:42.112722Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2023-12-05T22:33:42.112723Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2023-12-05T22:33:42.112725Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2023-12-05T22:33:42.112726Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2023-12-05T22:33:42.112728Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2023-12-05T22:33:42.112729Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2023-12-05T22:33:42.112731Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2023-12-05T22:33:42.112732Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2023-12-05T22:33:42.112733Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2023-12-05T22:33:42.112735Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2023-12-05T22:33:42.112736Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2023-12-05T22:33:42.112738Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2023-12-05T22:33:42.112739Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2023-12-05T22:33:42.112740Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2023-12-05T22:33:42.112742Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2023-12-05T22:33:42.112743Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2023-12-05T22:33:42.112744Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2023-12-05T22:33:42.112746Z 0 [Note] Shutting down plugin 'InnoDB'
2023-12-05T22:33:42.112799Z 0 [Note] InnoDB: FTS optimize thread exiting.
2023-12-05T22:33:42.112925Z 0 [Note] InnoDB: Starting shutdown...
2023-12-05T22:33:42.213131Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2023-12-05T22:33:42.213563Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 231205 22:33:42
2023-12-05T22:33:43.319042Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12219253
2023-12-05T22:33:43.320478Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2023-12-05T22:33:43.320503Z 0 [Note] Shutting down plugin 'MEMORY'
2023-12-05T22:33:43.320509Z 0 [Note] Shutting down plugin 'CSV'
2023-12-05T22:33:43.320513Z 0 [Note] Shutting down plugin 'sha256_password'
2023-12-05T22:33:43.320515Z 0 [Note] Shutting down plugin 'mysql_native_password'
2023-12-05T22:33:43.320648Z 0 [Note] Shutting down plugin 'binlog'
2023-12-05T22:33:43.322061Z 0 [Note] mysqld: Shutdown complete

2023-12-05 22:33:44+00:00 [Note] [Entrypoint]: Temporary server stopped

2023-12-05 22:33:44+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.

2023-12-05T22:33:44.285545Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-05T22:33:44.286667Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 1 ...
2023-12-05T22:33:44.289675Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-12-05T22:33:44.289700Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-12-05T22:33:44.289705Z 0 [Note] InnoDB: Uses event mutexes
2023-12-05T22:33:44.289708Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-12-05T22:33:44.289710Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-12-05T22:33:44.289712Z 0 [Note] InnoDB: Using Linux native AIO
2023-12-05T22:33:44.289925Z 0 [Note] InnoDB: Number of pools: 1
2023-12-05T22:33:44.290033Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-12-05T22:33:44.292022Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-12-05T22:33:44.297516Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-05T22:33:44.299413Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-12-05T22:33:44.310841Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-12-05T22:33:44.318160Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-12-05T22:33:44.318212Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-12-05T22:33:44.349111Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-12-05T22:33:44.349693Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-12-05T22:33:44.349703Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-12-05T22:33:44.350187Z 0 [Note] InnoDB: Waiting for purge to start
2023-12-05T22:33:44.400337Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 12219253
2023-12-05T22:33:44.400521Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-12-05T22:33:44.400648Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-12-05T22:33:44.402615Z 0 [Note] InnoDB: Buffer pool(s) load completed at 231205 22:33:44
2023-12-05T22:33:44.404402Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-12-05T22:33:44.404416Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-12-05T22:33:44.404419Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-12-05T22:33:44.404421Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-12-05T22:33:44.404840Z 0 [Warning] CA certificate ca.pem is self signed.
2023-12-05T22:33:44.404873Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-12-05T22:33:44.405384Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2023-12-05T22:33:44.405424Z 0 [Note] IPv6 is available.
2023-12-05T22:33:44.405439Z 0 [Note]   - '::' resolves to '::';
2023-12-05T22:33:44.405451Z 0 [Note] Server socket created on IP: '::'.
2023-12-05T22:33:44.407515Z 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.
2023-12-05T22:33:44.414622Z 0 [Note] Event Scheduler: Loaded 0 events
2023-12-05T22:33:44.416149Z 0 [Note] mysqld: ready for connections.
Version: '5.7.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

But when I run podman logs athena_redmine_1, I get a lot of repeated error messages:

rake aborted!
ActiveRecord::ConnectionNotEstablished: Unknown server host 'db' (-2)
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:45:in `rescue in new_client'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:39:in `new_client'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in `mysql2_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:283:in `connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `each'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/rake-13.1.0/exe/rake:27:in `<top (required)>'

Caused by:
Mysql2::Error::ConnectionError: Unknown server host 'db' (-2)
/usr/local/bundle/gems/mysql2-0.5.5/lib/mysql2/client.rb:97:in `connect'
/usr/local/bundle/gems/mysql2-0.5.5/lib/mysql2/client.rb:97:in `initialize'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in `new'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in `new_client'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in `mysql2_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:283:in `connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `each'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/rake-13.1.0/exe/rake:27: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

So I guess this is the reason the web server inside the container does not start. Why I'm getting this by using podman? By docker it works correctly.

shard77 commented 11 months ago

I'm encountering the same problem here.. strange

yosifkit commented 11 months ago

This is not an issue with the redmine image or the example compose file. It is expected that the redmine container will fail to stay running until it can access the configured database (since it needs to start with a db:migrate).


I would guess that you need a plugin when using podman (https://github.com/containers/podman-compose/tree/bce40c2db30fb0ffb9264b5f51535c26f48fe983#podman-compose):

podman dnsname plugin: It is usually found in the podman-plugins or podman-dnsname distro packages, those packages are not pulled by default and you need to install them. This allows containers to be able to resolve each other if they are on the same CNI network.

D3vil0p3r commented 11 months ago

I installed on Debian the package containernetworking-plugins (that seems the only one I see related to podman-dnsname), I rebooted the server but I still get the same error when I restart the container. I'm working as rootless.

UPDATE: upgrading Debian 11 to 12 and installing netavark, removing the containers, reboot and re-run podman-compose up -d fixed the issue. So netavark was the needed package. So, summarizing, the needed packages are:

appstream
slirp4netns
netavark