MariaDB Uuid as Primary Key Performance Problem / Tweaks
UUIDs are not nice when it comes to performance.  In particular, there is no relationship between the 'next' row you fetch via a UUID and all the other rows that are currently cached.
Docker possibly has a &quot;small&quot; value for innodb_buffer_pool_size, thereby leading to I/O when random accesses into the table happen.
UUID v1 can have its bits shuffled to make them &quot;chronological&quot;, would remove most of the &quot;randomness&quot; of accesses.  But you are using v4.
Plan A:  Abandon UUIDs.
Plan B:  Use UUID v1 and shuffle the bits
Plan C:  Give docker enough room to have a big buffer_pool so that most of the indexes can be kept in RAM.
More:  http://mysql.rjweb.org/doc.php/uuid