Installing Rancher for Docker on Windows

NIKITA MAHOVIYA
4 min readJul 28, 2024

--

Here’s a step-by-step guide for installing Rancher for Docker on a Windows operating system:

Step 1: Install Docker Desktop for Windows

  1. Download Docker Desktop
  • Go to the Docker Desktop download page: Docker Desktop for Windows.
  • Download and run the installer.
  • Make sure all the prerequisites are checked before installation.

2. Install Docker Desktop:

  • Follow the on-screen instructions to complete the installation.
  • Once installed, launch Docker Desktop.
  • You might need to log in with your Docker Hub credentials or create an account if you don’t have one.

3. Verify Installation:

  • Open a Command Prompt or PowerShell window.
  • Run the following command to ensure Docker is installed correctly and running.
docker --version

Step 2: Install Rancher

  1. Pull the Rancher Docker Image:
  • Open a Command Prompt or PowerShell window.
  • Run the following command to pull the Rancher image:
docker pull rancher/rancher:latest

2. Run the Rancher Container:

  • After the image is downloaded, run the following command to start the Rancher container:
docker run -d - restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest
  • This command runs the Rancher container in detached mode (-d), restarts it automatically unless stopped ( — restart=unless-stopped), and maps ports 80 and 443 on your host to the same ports on the container.
  • To run the Rancher container on different ports (if port 80 is in use by another process), you can use the following command. This example uses port 8080 for HTTP and port 8443 for HTTPS:
docker run -d - restart=unless-stopped -p 8080:80 -p 8443:443 rancher/rancher:latest

3. Verify the container is running:

To verify that the container is running, run the following command in command prompt:

docker ps

Ensure that the Rancher container is listed and that it is up and running. It should show the correct ports mapped (8080 and 8443 in this case).

4. Access Rancher:

  • Open your web browser and navigate to
https://localhost:8443

Troubleshooting:

For checking logs run the following command in command prompt:

docker logs <container_id>

Replace <container_id> with the actual container ID of the Rancher container (which you can get from the docker ps command).

If while viewing logs you receive errors as shown below:

Fig: Erros while viewing logs

To resolve this, run the Rancher Container with the — privileged Flag, use different ports to avoid conflicts, if necessary. Here’s the command using ports 8888 for HTTP and 8444 for HTTPS:

docker run -d --privileged --restart=unless-stopped -p 8888:80 -p 8444:443 rancher/rancher:latest

After running the above command view the Rancher container using the following command

docker ps
Fig: Rancher Container

Once done, open localhost and Tadaa you are done.

Fig: Rancher on localhost

To access the Bootstrap password for login enter the following command in the command prompt:

docker logs <container_id> 2>&1 | findstr "Bootstrap Password:"

This command will search the logs for the line containing “Bootstrap Password:” and display it. Replace <container_id> with your actual container ID.

This is how you can login to Rancher as a first time visitor to Rancher. After logging in you can either set up your own password (make sure, that the length of the password is 12)

Fig: Rancher credential page

or use a randomly generated password.

Once done, click on all the checkboxes and continue.

You are now all set!!

Fig: Rancher Dashboard

--

--

No responses yet