Like the OP, I had the same issue using a docker container, and this was the only thing that worked for me.
I added the following line to my settings.py file…
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": "debug_toolbar.middleware.show_toolbar_with_docker",
}
Credit for this fix goes to Google’s AI search result.