Accessing database when GitLab Docker container is not starting

My GitLab Docker container is unable to upgrade itself and keeps breaking due to some issue in the database. How can I access the database (e.g. via gitlab-rails dbconsole) when I cannot start my container?