---
url: /v6.2/en-us/docker-upgrade.md
---
# Version Upgrade for Container Deployment

When upgrading the HENGSHI version, please follow the steps below to perform the upgrade on the container.

1. Obtain and import the offline image.
   ```sh
   wget https://download.hengshi.com/releases/hengshi-sense-xxx.tar.gz
   docker load -i hengshi-sense-xxx.tar.gz

   # If the container runtime uses containerd, you need to use docker to convert the format to tar before importing
   ctr -n k8s.io images import hengshi-sense-xxx.tar
   ```

2. No automatic backup is available; manually back up data before upgrading! [Container Environment Backup](docker-backup-restore.md#backup-metadb)

3. Stop the service.
   ```shell
   # Navigate to the current deployment directory to stop the service
   # For example, if deployed in the /data directory, the full path is usually /data/docker-compose-x.x 
   # Please use the actual path; do not directly copy and paste the commands.
   cd docker-compose-x.x
   docker-compose down
   ```

4. Obtain the docker-compose deployment file for the upgrade version. Configuration files can be referenced in [Preparation Before Deployment](docker.md).

5. Update the HENGSHI image tag.
   ```shell
   # For example, if deployed in the /data directory, the full path is usually /data/docker-compose-x.x 
   # Please use the actual path; do not directly copy and paste the commands.
   cd docker-compose-x.x
   NEW_TAG=hengshi-sense-xxx # Set the variable to the new tag
   sed -i -e "s/^HS_IMAGE_TAG=.*$/HS_IMAGE_TAG=${NEW_TAG}/" .env
   ```

6. Start the service to complete the upgrade.
   ```shell
   # For example, if deployed in the /data directory, the full path is usually /data/docker-compose-x.x 
   # Please use the actual path; do not directly copy and paste the commands.
   cd docker-compose-x.x
   docker-compose up -d
   ```

7. Upgrade version **>=4.0** considerations:
   1. For service images >= version 4.0, Metadb's default version is 13.5. You can decide whether to perform an upgrade operation based on your needs.
   2. [Upgrade Operation](metadb-upgrade.md)
   3. Maintain the current version:
      1. Edit the docker-compose.yaml file and modify the parameter under metadb>image configuration **${HS_IMAGE_TAG:-need_hs_image_version}** to <4.0 version image information.

8. Notes:
   1. In version 5.1.x, Flink has been removed and does not need to be run. After upgrading, you may consider stopping and cleaning up the Flink container.

# Rollback

1. Rollback Procedure\
   Update the image used by docker-compose to the old version image

```shell
docker-compose down
sed -i -e "s/^HS_IMAGE_TAG=.*$/HS_IMAGE_TAG=${OLD_TAG}/" .env
```

2. Rollback Data\
   Use [Container Restore](docker-backup-restore.md#restore-metadb) to restore the metadb operation process
