Note: If you are upgrading to v1.4.x, please read our release notes on v1.4.0 regarding what to expect for this upgrade.
Depending on how you installed Rancher server, your upgrade steps may vary.
Note: If you set any environment variables or passed in a ldap certificate in your original Rancher server setup, you’ll need to add those environment variables or certificate in any new command.
Rancher server has 2 different tags. For each major release tag, we will provide documentation for the specific version.
rancher/server:latest
tag will be our latest development builds. These builds will have been validated through our CI automation framework. These releases are not meant for deployment in production.rancher/server:stable
tag will be our latest stable release builds. This tag is the version that we recommend for production.Please do not use any release with a rc{n}
suffix. These rc
builds are meant for the Rancher team to test out builds.
After a Rancher server upgrade, your infrastructure services may have an upgrade available. We recommend checking your infrastructure stacks after upgrading Rancher server to see if any stack has an upgrade available. If there is an upgrade available, upgrade these stacks one at a time. Please finish the upgrade before moving on to upgrading the next infrastructure stack.
Each Rancher agent version is pinned to a Rancher server version. If you upgrade Rancher server and Rancher agents require an upgrade, we will automatically upgrade the agents to the latest version of Rancher agent.
If you have launched Rancher server without using an external DB or bind mounted MySQL volume, the Rancher server database is inside your Rancher server container. We will use the running Rancher server container to create a data container. This data container will be used to start new Rancher server containers by using a --volumes-from
. Alternatively, you can copy the database out of the container to a directory on the host and bind mount the database.
Stop the container.
$ docker stop <container_name_of_original_server>
Create a rancher-data
container. Note: This step can be skipped if you have already upgraded in the past and already have a rancher-data
container.
$ docker create --volumes-from <container_name_of_original_server> \
--name rancher-data rancher/server:<tag_of_previous_rancher_server>
Pull the most recent image of Rancher Server. Note: If you skip this step and try to run the latest
image, it will not automatically pull an updated image.
$ docker pull rancher/server:latest
Launch a new Rancher Server container using the database from the rancher-data
container. Any changes in Rancher will be saved in the rancher-data
container. If you seen an exception in the server regarding a log lock, please refer to how to fix the log lock.
Note: Depending on how long you’ve had Rancher server, certain database migrations may take longer than expected. Please do not stop upgrades in the middle of upgrading as you will hit a database migration error the next time you upgrade.
$ docker run -d --volumes-from rancher-data --restart=unless-stopped \
-p 8080:8080 rancher/server:latest
Remove the old Rancher server container. Note: If you only stop the container, the container will be restarted if your machine is rebooted if you had used --restart=always
. We recommend using --restart=unless-stopped
and removing the container after your upgrade has been successful.
If you launched Rancher server using an external database, you can stop the original Rancher server container and launch a new version of Rancher server using the same external DB instructions. Before upgrading your Rancher server, we recommend backing up your external database. After the new server is up and running, you can remove the old Rancher server container.
Stop the running Rancher Server container.
$ docker stop <container_name_of_original_server>
Copy the database files out of the server container. Note: If you already have the database stored on the host, you can skip this step. Also, if the DB has been copied out of the container, it will be inside /
$ docker cp <container_name_of_original_server>:/var/lib/mysql <path on host>
Now set the UID/GID for the folder so that the mysql user within the container has the correct ownership of the mysql mount.
$ sudo chown -R 102:105 <path on host>
Start new server container.
$ docker run -d -v <path_on_host>:/var/lib/mysql -p 8080:8080 \
--restart=unless-stopped rancher/server:latest
Note: It is important that you have trailing ‘/’ at the end of the host path if you have copied a database out of a previous container. Otherwise, the directory ends up in the wrong place.
Remove the old Rancher server container. Note: If you only stop the container, the container will be restarted if your machine is rebooted if you had used --restart=always
. We recommend using --restart=unless-stopped
and removing the container after your upgrade has been successful.
If you have launched Rancher server in High Availability (HA), the new Rancher HA set up will continue using the external database that was used to install the original HA setup.
Note: When upgrading an HA setup, all
rancher/server
containers have to be stopped. The Rancher server setup will be down during the upgrade.
Before upgrading your Rancher server, we recommend backing up your external database.
On each node in the HA setup, stop the running Rancher server containers. Then start a new Rancher server container on one host using the same command that you had used when installing Rancher server, but with a new Rancher server image tag. When the container is fully started (UI and API are responding, and the server is listed under Admin
-> High Availability
in the UI), you can start the new Rancher server container.
# On all nodes, stop all Rancher server containers
$ docker stop <container_name_of_original_server>
# Start a new container with the new version tag
$ docker run -d --restart=unless-stopped -p 8080:8080 -p 9345:9345 rancher/server:<tag_of_new_version> --db-host myhost.example.com --db-port 3306 --db-user username --db-pass password --db-name cattle --advertise-address <IP_of_the_Node>
Note: If you are upgrading from an HA setup that was running the older version of HA, you would need to remove all running Rancher HA containers.
$ sudo docker rm -f $(sudo docker ps -a | grep rancher | awk {'print $1'})
Users without internet will need to download the latest infrastructure service images in order for the upgrade to succeed. Without the images in the latest default templates, the infrastructure services will not be able to upgrade.