The documentation is missing the actual steps to enable and configure the TOTP extension while using docker. Similarly to the passed environment variables and the documentation about how the image works with other extensions it should also contain a section about configuring and working with the TOTP extension. Through my own trials I have found that enabling the TOTP extension is accomplished by adding the environment variable TOTP_ENABLED="true".
But this alone, depending on your timezone, might make the extension work unreliably. To make the codes work reliably the timezone must be set on the containers using the variable TZ as in TZ="Europe/Bucharest".