In entrypoint.sh:
manage.py is run as root
- the chown of /config takes place before the creation of the database and secret key
This means that a non-root UID/GID cannot edit the database on the first run.
On subsequent runs, the chmod kicks in and everything runs properly.