Solr core files are not created on docker hub

Dear Community members

I am new in docker. My docker desktop is running on windows 10. I have to run solr in a docker container and then push it to docker private repository hub.

I am following the article https://github.com/docker-solr/docker-solr

I have an azure web app running in Linux with a docker container - which will call the docker image from the docker hub repository private.

http://solrdockerwebapp.azurewebsites.net/solr/#/--this is a web app running on azure.

I have downloaded the solr in docker desktop using PowerShell command.

docker pull solr:latest 
 docker run -d -p 8983:8983 --name my_solr solr:v1

I checked in the local browser http://localhost:8983/solr/# it is running properly. Now I create one new solr core file and this generates under a folder solrdata/data/core_demo.

But If I push the image in docker private repository there this core files are not going up.

Below is my docker file:

FROM solr:latest
ARG SOLR_VERSION="8.5.2"
COPY --chown=0:0 scripts /opt/docker-solr/scripts
VOLUME /var/solr
EXPOSE 8983
WORKDIR /opt/solr
USER $SOLR_USER
COPY  var/solr/server/solr/data/demo_core var/solr/server/solr/data
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["solr-foreground"]

Build and Commit the image.

docker commit my_solr myprivaterepo/solr:latest 
docker push myprivaterepo/solr:latest 

But after pushing the image to docker hub these core files and folders are not adding up there. So the azure solr web app is running only solr without any core files.

Any suggestions or help will be very helpful.