Why does WAL on postgresql takes so long to replay?
Docker shouldn't be crashing all the time.  Maybe whatever is making it do that is also making it very slow when it isn't crashed.  Look in the log files for the OS and for docker (and for PostgreSQL) to see what they say.

Find the pid of the startup process, and do:

strace -y -ttt -T -p &lt;pid&gt;


And see what it is doing.  This will show you, for example, if it is getting stalled on reads or writes or other system calls.  If it isn't, you can also use gdb -p &lt;pid&gt; to see what it is doing internally.  To get the most out of that, you will have to install the debug symbols, which I don't know how to do on the official docker image.