Problem during ./launcher rebuild, Redis not starting the second time

Hi everyone.

I had a problem rebuilding (updating) Discourse; in the log I found that during setup, a first time Redis is launched, with no problem, but after a while the setup tries to relaunch it again and crashes because of “server TCP listening socket *:6379: bind: Address already in use”.

After several try-and-errors, also with Gemini’s help, I put this piece of code inside app.yml

hooks: before_db_migrate: - exec: cmd: - "pkill -9 redis-server || true" - "sleep 2" - "exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf &" - "sleep 5"

and eventually the rebuild goes on.

Here’s a piece of log with my fix killin’ the reluctant Redis instance and starting it again:


389:C 24 Feb 2026 17:07:21.756 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

389:C 24 Feb 2026 17:07:21.756 * Redis version=7.4.7, bits=64, commit=00000000, modified=1, pid=389, just started

389:C 24 Feb 2026 17:07:21.756 * Configuration loaded

389:M 24 Feb 2026 17:07:21.756 * monotonic clock: POSIX clock_gettime

389:M 24 Feb 2026 17:07:21.757 * Running mode=standalone, port=6379.

389:M 24 Feb 2026 17:07:21.757 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use

389:M 24 Feb 2026 17:07:21.757 # Failed listening on port 6379 (tcp), aborting.

I, [2026-02-24T17:07:31.750972 #1]  INFO -- : > pkill -9 redis-server || true

I, [2026-02-24T17:07:31.758767 #1]  INFO -- : > sleep 2

I, [2026-02-24T17:07:33.761955 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf &

I, [2026-02-24T17:07:33.765205 #1]  INFO -- : > sleep 5

396:C 24 Feb 2026 17:07:33.773 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

396:C 24 Feb 2026 17:07:33.773 * Redis version=7.4.7, bits=64, commit=00000000, modified=1, pid=396, just started

396:C 24 Feb 2026 17:07:33.773 * Configuration loaded

396:M 24 Feb 2026 17:07:33.773 * monotonic clock: POSIX clock_gettime

396:M 24 Feb 2026 17:07:33.774 * Running mode=standalone, port=6379.

396:M 24 Feb 2026 17:07:33.775 * Server initialized

396:M 24 Feb 2026 17:07:33.776 * Loading RDB produced by version 7.4.7

396:M 24 Feb 2026 17:07:33.776 * RDB age 19606 seconds

396:M 24 Feb 2026 17:07:33.776 * RDB memory usage when created 4.60 Mb

396:M 24 Feb 2026 17:07:33.787 * Done loading RDB, keys loaded: 3413, keys expired: 1.

396:M 24 Feb 2026 17:07:33.788 * DB loaded from disk: 0.013 seconds

396:M 24 Feb 2026 17:07:33.788 * Ready to accept connections tcp

My question now is: WHY two Redis launches? And why the second one finds the first still hanging on port 6379? And again, why not trying to use it, if it’s already available?
And, last but not least, what could have given this problem? I know very well that I put a ointment on a wound without knowing WHY there’s the wound, but at least it’s running now.

Before someone asks me, NO, I don’t have any other Redis running outside Discourse (otherwise, first attempt in the beginning of rebuild should have crashed), and YES, Discourse is running with many other containers on Docker, even if it never had such a problem until a few upgrade ago.

Any help and tip appreciated, and sorry if it’s already solved in other topic, but I searched with no success.