Files
rancher-docs/content/rancher/v2.x/en/upgrades/single-node-upgrade/_index.md
T
2018-06-26 13:25:27 -07:00

3.5 KiB

title, weight
title weight
Single Node Upgrade 1010

To upgrade Rancher Server 2.x after a new version is released, create a backup of your server and then run the upgrade command.

Prerequisites: Open Rancher and write down the version number displayed in the lower-left of the browser (example: v2.0.0). You'll need this number during the upgrade process.

  1. Stop the container currently running Rancher Server. Replace <RANCHER_CONTAINER_ID> with the ID of your Rancher container.

docker stop <RANCHER_CONTAINER_ID> ```

>**Tip:** You can obtain the ID for your Rancher container by entering the following command: `docker ps`.
  1. Create a container of your current Rancher data for use in your upgraded Rancher Server. Name the container rancher-data.

    • Replace <RANCHER_CONTAINER_ID> with the same ID from the previous step.
    • Replace <RANCHER_CONTAINER_TAG> with the version of Rancher that you are currently running, as mentioned in the Prerequisite above.

docker create --volumes-from <RANCHER_CONTAINER_ID>
--name rancher-data rancher/rancher:<RANCHER_CONTAINER_TAG> ```

  1. Create another container of your current Rancher data. However, this container is a backup for restoring your Rancher Server if your upgrade is unsuccessful. Name the container rancher-data-snapshot-<CURRENT_VERSION>.

    • Replace <RANCHER_CONTAINER_ID> with the same ID from the previous step.
    • Replace <CURRENT_VERSION> with the tag for the version of Rancher currently installed.
    • Replace <RANCHER_CONTAINER_TAG> with the version of Rancher that you are currently running, as mentioned in the prerequisite.

docker create --volumes-from <RANCHER_CONTAINER_ID>
--name rancher-data-snapshot-<CURRENT_VERSION> rancher/rancher:<RANCHER_CONTAINER_TAG> ```

  1. Pull the most recent image of Rancher.

docker pull rancher/rancher:latest ```

>**Attention Air Gap Users:**
> If you are visiting this page to complete [Air Gap Upgrade]({{< baseurl >}}/rancher/v2.x/en/upgrades/upgrade-scenarios/air-gap-upgrade/), prepend your private registry URL to the image when running the `docker run` command.
>
> Example: `<registry.yourdomain.com:port>/rancher/rancher:latest`
>
  1. Launch a new Rancher Server container using the rancher-data container.

docker run -d --volumes-from rancher-data --restart=unless-stopped
-p 80:80 -p 443:443 rancher/rancher:latest ``` >Note: Do not stop the upgrade after initiating it, even if the upgrade process seems longer than expected. Stopping the upgrade may result in database migration errors during future upgrades. >
>
>Note: After upgrading Rancher Server, data from your upgraded server is now saved to the rancher-data container for use in future upgrades.

  1. Remove the previous Rancher Server container.

    If you only stop the previous Rancher Server container (and don't remove it), the container may restart after the next server reboot.

  2. Log into Rancher. Confirm that the upgrade succeeded by checking the version displayed in the bottom-left corner of the browser window.

Result: Rancher Server is upgraded to the latest version.

Note: If your upgrade does not complete successfully, you can roll Rancher Server and its data back to its last healthy state. For more information, see [Restoring Backups—Single Node Installs]({{< baseurl >}}/rancher/v2.x/en/upgrades/restorations/single-node-restoration/).