A brief guide to deploying Rancher Server on a Single Node Using Docker
docker run --name rancher-server -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
-v /<CERT_DIRECTORY>/<FULL_CHAIN.crt>:/etc/rancher/ssl/cert.pem \
-v /<CERT_DIRECTORY>/<PRIVATE_KEY.key>:/etc/rancher/ssl/key.pem \
-v /<CERT_DIRECTORY>/<CA_CERTS.pem>:/etc/rancher/ssl/cacerts.pem \
-v ${PWD}/:/var/lib/rancher \
--privileged \
rancher/rancher:v2.5.3
docker run --name rancher-server -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
-v ${PWD}/certs/rancher.mydomain.com.crt:/etc/rancher/ssl/cert.pem \
-v ${PWD}/certs/rancher.mydomain.com.key:/etc/rancher/ssl/key.pem \
-v ${PWD}/certs/myCA.pem:/etc/rancher/ssl/cacerts.pem \
-v ${PWD}/:/var/lib/rancher \
--privileged \
rancher/rancher:v2.5.3
docker ps
docker stop rancher-server
cd /opt
sudo tar -czpf rancher-2.5.0-2020-01-08.tgz rancher
docker start rancher-server
- Move the tarball you want to restore onto the Rancher server and place it in
/opt
- Stop the Rancher container
- Move
/opt/rancher
to/opt/rancher.bak
- Extract the tarball. This will create a new
/opt/rancher
- Start the Rancher container
docker ps
docker stop rancher-server
cd /opt
mv rancher rancher.old
tar xzpf rancher-2.5.0-2020-01-08.tgz
docker start rancher-server
The upgrade procedure for Rancher running in a Docker container is similar to the procedure for making and restoring a backup, except that instead of starting the existing Rancher container, we'll start a new one with the new version. Rancher will perform any upgrades on the data itself when it starts.
- Stop the Rancher container
- Create a tarball of copy from the bind-mount directory
- Pull the latest or desired version of the Rancher server container image
- Start a new container with the same certificate options as the original container, mounting the bind-mount host directory to
/var/lib/rancher
- Verify the upgrade by logging into the new Rancher server and confirming that it is operating correctly.
- Delete the stopped Rancher container so that it doesn't restart if the host is rebooted.
docker ps
docker stop rancher-server
cd /opt
cp -Rp rancher rancher.bak
mv /opt/rancher.bak /asafeplace/
docker run --name rancher-server -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
-v /<CERT_DIRECTORY>/<FULL_CHAIN.crt>:/etc/rancher/ssl/cert.pem \
-v /<CERT_DIRECTORY>/<PRIVATE_KEY.key>:/etc/rancher/ssl/key.pem \
-v /<CERT_DIRECTORY>/<CA_CERTS.pem>:/etc/rancher/ssl/cacerts.pem \
-v ${PWD}/:/var/lib/rancher \
--privileged \
rancher/rancher:v2.6.0