Instructions
- Setup the following script. We will fill it in going forward
RANCHER_CONTAINER_ID=
RANCHER_CONTAINER_TAG=
URL=rancher.yourdomain.com
TAG=stable
TIMESTAMP() {
date +%Y-%m-%d_%H-%M-%S
}
- SSH into your rancher droplet
ssh [email protected]
-
Get the
CONTAINER_ID
by running the command below, and fill it on the script from step 1
docker ps -a
RANCHER_CONTAINER_ID=1cb2c853937b
RANCHER_CONTAINER_TAG=
URL=rancher.yourdomain.com
TAG=stable
TIMESTAMP() {
date +%Y-%m-%d_%H-%M-%S
}
-
Go to your installation of rancher at
rancher.yourdomain.com
and find the rancher version on the bottom left of the screen. Fill this into the script from step 1.
RANCHER_CONTAINER_ID=1cb2c853937b
RANCHER_CONTAINER_TAG=v2.2.4
URL=rancher.yourdomain.com
TAG=stable
TIMESTAMP() {
date +%Y-%m-%d_%H-%M-%S
}
-
Go back to your droplet and paste the script we’ve been building
-
Stop the container currently running rancher
docker stop $RANCHER_CONTAINER_ID
- Pull the latest stable version of rancher
docker pull rancher/rancher:$TAG
- Create a volume from the rancher container. If you’ve already done this during a earlier upgrade or backup you can skip this step.
docker create --volumes-from $RANCHER_CONTAINER_ID \
--name rancher-data rancher/rancher:$RANCHER_CONTAINER_TAG
- Create a backup of your rancher volume into a single file
docker run --volumes-from rancher-data -v $PWD:/backup alpine tar zcvf /backup/rancher-data-backup-$RANCHER_CONTAINER_TAG-$(TIMESTAMP).tar.gz /var/lib/rancher
-
Confirm that a new backup files exists with the container tag and timestamp
-
Start the new version of rancher
docker run -d --volumes-from rancher-data \
--restart=unless-stopped -p 80:80 -p 443:443 \
rancher/rancher:$TAG --acme-domain $URL
-
Go back into your rancher instance, log back in and confirm that you are running the latest stable version
-
Remove the old stopped rancher container
docker rm $RANCHER_CONTAINER_ID
Screencast
Resources
Get More!