Unable to restore the backup file in home assistant

I am system migration for home assistant to new system, but Restore the backup is not working anf below are the steps I followed(I tried many times So I created simple shell script)

Software used: Home Assistant Core (in Docker Container)

To Create backup: Settings>System>Backups

& To restore (Backup file is copied to ~/Downloads/core_2023_8_4.tar)


echo “Delete the files contains in config/ Folder”
sudo rm -r config/*
echo “…”

echo “copying backup”
cp ~/Downloads/core_2023_8_4.tar config/

echo “unzip the backup file”
cd config/
tar -xvf core_2023_8_4.tar
tar -xvf homeassistant.tar.gz
cd …
echo “unzip over…\n\n”

echo “Downloading lastest hass…”
sudo docker pull ghcr.io/home-assistant/home-assistant:stable

echo “Installing the home assistant”
sudo docker stop homeassistant
sudo docker rm homeassistant

echo “Creating the container”
sudo docker run -d
–name homeassistant
–restart=unless-stopped
–privileged
-e TZ=MY_TIME_ZONE
-v /home/jai/hass/config:/config
–network=host
ghcr.io/home-assistant/home-assistant:stable #

echo “Waiting for 6 seconds…”
sleep 6


Please help to resolve my issue

Thanks in Advance!!!