The template has wrong path. You need to edit the container and change the "Host Path 1" setting's "Container Path" value to "/var/lib/influxdb2". Otherwise the database is created inside the container and not on host and it will be reset every time you update the container.