Is it safe to remove NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD from docker compose after setting up?

I am doing a bit of maintenance with my nextcloud docker installation, and I was wondering if it was ok to remove the NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD tags that I had initially set in docker compose and now would like to remove from my env files. I just commented them out now, and Nextcloud still seems to boot completely OK. But I’m wondering if this is going to cause any problems in the future with upgrades.

The docker entrypoint scripts seem to imply that they are only used during initial setup around a comment labeled “Install”, but I also noticed in another section for version 28 (and every other version for that matter), that the install section is ran again using these variables. So it makes me mildly nervous.

Yes, it’s fine. Those variables are only used for the very first run (install). And they’re also not referenced in the auto-configuration *.config.php files at all.