This is how it is set by IOTstack. I'm new this to docker, RPi and Pihole.
I have successfully set a new password as described above several times.
Wondering why the new password does not persist if I restart the container or stack. Shouldn't manually setting a password override whatever is set in docker-compose ?
This would be in addition to your manual password creation approach from within your container:
You shouldn't change the password from within the container.
Instead, use the WEBPASSWORD environment, as you already do, but exclusively.
You may have to readjust the way how you do that, though.
Is %randomAdminPassword%literally a part of your Pi-hole container configuration?
If so, replace that by some constant text.
Otherwise, your container would use whatever value is currently stored in %randomAdminPassword%, which -judging by its name containing random- may very likely change on every access or every restart, as probably configurable by your IOTstack.
Yes, %randomAdminPassword% is literally what my environment variable is. That is the default value that was included in my IOTstack installation.
This was the same config I used for few months and I did not have password issues until latest update.
I have changed it to a constant value and it works now so thanks for your help!
So when do you have to use sudo pihole -a -p ? Only in non docker installations ? i'm just wondering if including the password in the docker-compose file is the best practice.
That would be the expected behaviour if that container has been running without interruption during all that time. As an update requires a restart, that would be when a new random password from %randomAdminPassword% would have been set.
Yes.
As mentioned before, use the WEBPASSWORD environment variable for a dockered Pi-hole.
Just adding to this that %randomAdminPassword% is replaced at install time for IOTstack. %randomAdminPassword% is used in the template docker file, but the installation script searches for this string and updates it.
i have similar to your problem.
I'm running pi-hole as docker container too, i forgot my password and i reset it again, but every time i have to login i reset the password
and i found the solution to my problem,
logged in to portainer to check the container and i found that when i set the container the first time i typed the the admin password in the environment variable WEBPASSWORD= i.e-mypassword