How can I do to recover admin password?
When I remove all containers, images, cache,... and rebuild again. I not see admin password (old password admin is lost)
WARN[0000] The "DD_DATABASE_HOST" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_CELERY_BROKER_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_HOST" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_CELERY_BROKER_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_NAME" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_HOST" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_CELERY_BROKER_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_HOST" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_NAME" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "DD_DATABASE_PASSWORD" variable is not set. Defaulting to a blank string.
django-defectdojo-initializer-1 | Admin password: Initialization detected that the admin user admin already exists in your database.
How can I do to recover admin password?
See #10392
BTW, unless your DB is running in a container and you delete the volume that the DB container uses, it will persist in the DB which appears to be what happened here.
Also all those WARN[0000] lines don't look great - hopefully you've set those as ENV variables.
Thank you very much. I can reset password. Can you guide detail me how to fix WARN[0000]?
The reason I didn't say more about the WARN[000] is that there's not enough information in your issue to say more.
I can tell your using compose because of the error messages but not much more.
In general, those DD_[something] environmental variables are set in the environment where you launch compose or they could be hard coded into the compose file - both work.
Here's an example of a variable that expects DD_DATABASE_URL to already be set in the environment when you start compose: https://github.com/DefectDojo/django-DefectDojo/blob/master/docker-compose.yml#L53
If you look at setEnv.defectdojo and env.defectdojo in the community contrib repo, you'll see one option to set this before launching compose: https://github.com/DefectDojo/Community-Contribs/tree/master/CentOS-7-deploy/dojo
Years later I found this page facing the same issue. Discovered in the docker logs that we can run this command to establish a new admin/password:
docker compose exe uwsgi /bin/bash -c 'python manage.py createsuperuser'
Thanks to the DefectDojo developer who added that python script and included the command in the docker logs. Very helpful!
@delers447 Please check the documentation for the easiest solution: https://github.com/DefectDojo/django-DefectDojo/blob/master/readme-docs/DOCKER.md#option-to-change-the-password