Incapio - Blog Posts © 2022 by Incapio is licensed under CC BY-SA 4.0 

Install Rancher on Compute Engine with Docker | Google Cloud(GCP)

Updated: Jan 28


You will need the following items to complete this tutorial.

  • A Compute Engine VM instance with Ubuntu.

  • Docker Engine Installation.

  • A Domain(Registered at any hosting provider).

  • A Wildcard SSL certificate.

What is Rancher?.

Rancher is a Kubernetes cluster management software. Rancher covers not just managing existing clusters but also creating new clusters. For example, you may import pre-existing clusters, such as EKS and GKE, or design and deploy your own using RKE or K3s.

Step - 1. Create a Compute Engine VM instance.

  • In the Google cloud console, navigate to compute engine VM instance and create an instance with ubuntu operating system also allow http and https traffic.

firewall, https, http, traffic, network tags, hostname
Google Cloud(GCP) - Networking Interface
  • Lastly, assign a hostname to the VM instance.

  • Finally, click on the create option to deploy the VM instance.

Step - 2. Install Docker Engine on the Compute Engine VM instance

  • Open secure shell access(SSH) on the VM instance and install the Docker in the VM instance.

  • To install Docker, use the following command. To learn more about installing Docker on Linux, visit the link here.

 sudo apt-get install docker-ce docker-ce-cli
  • To verify Docker Engine, run the following command.

 ~# docker version
  • Output:

Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:45:27 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Server: Docker Engine - Community
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:36 2021
  OS/Arch:          linux/amd64
  Experimental:     false
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
  Version:          0.19.0
  GitCommit:        de40ad0

Step - 3. Install Rancher on a Single Node using Docker along with Wildcard SSL certificate.

  • To generate a Let's Encrypt Wildcard SSL, Visit the link here.

  • Next, upload the certificates "Full-Chain.pem", "CA-Cert.pem", and "Private-key.pem" to any directory.

  • To install the Rancher, run the following command.

docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  -v /<CERT_DIRECTORY>/<FULL_CHAIN.pem>:/etc/rancher/ssl/cert.pem \
  -v /<CERT_DIRECTORY>/<PRIVATE_KEY.pem>:/etc/rancher/ssl/key.pem \
  -v /<CERT_DIRECTORY>/<CA_CERTS.pem>:/etc/rancher/ssl/cacerts.pem \
  --privileged \
  • Replace the <cert-directory> with the directory path where your SSL certificates have been uploaded.

  • Rename <FULL_CHAIN.pem>, <PRIVATE_KEY.pem>, and <CA_CERTS.pem> with your file names. .

  • Syntax:

docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  -v /home/info/full.pem:/etc/rancher/ssl/cert.pem \
  -v /home/info/key.pem:/etc/rancher/ssl/key.pem \
  -v /home/info/cert.pem:/etc/rancher/ssl/cacerts.pem \
  --privileged \
  • To verify the installation, run "docker ps" in the command-line interface

  • Output:

CONTAINER ID   IMAGE                    COMMAND           CREATED          STATUS          
PORTS                                                                      NAMES
a99237fd7684   rancher/rancher:latest   ""   21 seconds ago   Up 13 seconds>80/tcp, :::80->80/tcp,>443/tcp, :::443->443/tcp   condescending_no

Step - 4. Configure FQDN (Fully-Qualified Domain Name).

  • Add an "A record" point to Compute Engine VM instance in your domain DNS.

A record, name, value, TTL
GoDaddy Domain DNS Interface
  • To point the record, copy the VM instance External-IP, add an "A record" in the domains dns, and save it.

Step - 5. Initial Rancher Setup.

  • Type the URL(hostname) in the browser. For instance, replace "" with your domain name (

  • To log in to Rancher, we require a password. Run the following commands and replace container-id with your container id to get the password.

docker logs  container-id  2>&1 | grep "Bootstrap Password:"
  • To obtain container-id, run "docker ps" in shell, copy the id, replace it, and run the command in the shell.

  • Example:

docker logs  a99237fd7684  2>&1 | grep "Bootstrap Password:"
  • Output:

2022/01/05 13:29:09 [INFO] Bootstrap Password: s9kxfb4bkk9hcht65qps6asderyfghbjf9rg45xk9td8rljvq8t4sm
  • Lastly, copy-paste the password and log into the Rancher.

  • Finally, set a specific password for Rancher.

Rancher Web UI, Initial setup
Rancher Interface


Here are some recommended tips and tricks.

  • To remove a container, run the following commands.

docker stop container-id
docker rm container-id
164 views0 comments

Do you need assistance? Visit Forum to join the conversation.