Do you love Docker but can’t settle with the command line? Perhaps you’re looking for the convenience of a front-end GUI. If so, then Docker Rancher Desktop might be the solution for you.
Docker Rancher Desktop is a desktop application that can uncomplicate Docker and Kubernetes on your local machine. The application includes everything you need to run containers on your computer, including a GUI, command-line tools, and an integrated container registry.
Sounds great so far? Don’t go anywhere because this article will teach you how to install Docker Rancher Desktop on your machine. You will also explore some features that make Rancher Desktop an attractive choice for developers and ops engineers.
This tutorial will be a hands-on demonstration. If you’d like to follow along, be sure you have the following.
- Windows 10 build 1909 or higher, except Home Edition. This tutorial uses Windows 10 21H2.
- The computer CPU must have virtualization capabilities (Intel VT-x or AMD-V).
- 8 GB of RAM and 4 CPUs (may work with lower specs but with reduced performance).
- A code editor such as Visual Studio Code. This tutorial will use Visual Studio Code to demonstrate commands and editing code.
Related:What You Need to Know about Visual Studio Code: A Tutorial
Installing Rancher Desktop
Rancher Desktop is an open-source project that is free and available to any major operating system, such as Windows, macOS, and Linux.
This tutorial will focus on Docker Rancher Desktop on Windows. The functionality and interface will be the same across your platform. The only main difference is with the installation.
Follow the below steps to install Docker Rancher Desktop.
1. Open your web browser and open the Rancher Desktop GitHub releases page. The latest version as of this writing is 1.4.1.
2. Scroll down to the Assets section. Click the Rancher.Desktop.Setup-1.4.1.exe link. This file is a self-extracting executable. Save this file to a convenient location, such as your Downloads folder.
3. Locate and run the setup file to start the installation.
4. On the Rancher Desktop Setup installation wizard that appears, click I agree to accept the license agreement.
The installation starts right away. Wait a few minutes for the installation to complete.
5. After installing, click the Reboot now option and click Finish. The system reboot is necessary to complete the Rancher Desktop installation.
6. Launch the Rancher Desktop application after the reboot, either from the desktop shortcut or the Start menu.
7. The initial launch will show you the Welcome to Rancher Desktop window. Leave the default settings (Enable Kubernetes, select the stable, latest version, and containerd as the Container Runtime) and click Accept.
8. Wait for the Rancher Desktop to finish downloading components and starting services, and you’ll be ready to use the application.
Using Rancher Desktop: Building Images
Now that you have Docker Rancher Desktop installed, you can begin using it to build images. This section will teach you how to build a simple hello-world image using a Dockerfile and the nerdctl CLI.
Related:Using the Dockerfile ENTRYPOINT and CMD Instructions
Before diving in deep, familiarize yourself with the tools and names you’ll use as part of Rancher Desktop.
kubectl - the command-line interface for managing Kubernetes.
nerdctl - the command-line interface for managing (build, run, and push) images for Nerd applications.
Related:Getting Started With Kubernetes Helm
- Docker Compose – the tool for defining and running multi-container applications.
- Moby – a tool for accelerating the development of containerized applications.
Note: You will use the nerdctl and kubectl throughout this tutorial.
Follow the below steps to build a boilerplate hello-word image.
1. Open a PowerShell window.
2. Run the following command to verify the nerdctl version. This step ensures that nerdctl is available on your machine.
3. Run the below command to create a new hello-world folder in your profile directory. This folder will host the files related to your hello-world application.
mkdir ~/hello-world ; cd ~/hello-world
4. Open the current folder in Visual Studio Code.
5. Once in VSCode, click on the New File icon and create a new file called Dockerfile.
6. Copy and paste the following content into this Dockerfile file. This content defines a hello-world image that prints “Hello, world!” on the screen. Save the file after editing.
FROM alpineCMD ["echo", "Hello World!!"]
7. Run the below command on the terminal to build the image locally.
- The –tag flag specifies a name and tag for the image (helloworld:v1.0).
- The . (dot) at the end of the command tells nerdctl to look for the Dockerfile in the current working directory.
nerdctl build --tag helloworld:v1.0 .
If the build is successful, you will see the following output.
8. List the images in your local registry by running the following command.
You will see the helloworld image in the output. You can also see the image’s ID, Created time, and Size.
9. Run the following command to run the container. The –rm flag tells nerdctl to remove the container after running. This flag is useful for development and testing as you can quickly create and destroy containers without worrying about disk space.
nerdctl run --rm helloworld:v1.0
You will see the following output after successfully running the container.
10. Finally, remove the image from the registry to free up disk space if you don’t use it anymore. To do so, run the below command to untag and delete the image from the registry.
nerdctl rmi helloworld:v1.0
Deploying a Container to Kubernetes
So far, you have built a hello world container image and run the container locally. In this section, you will learn to build and deploy an NGINX image to Kubernetes and expose it locally.
Creating an NGINX Image
1. Create the nginx folder and open that folder in VSCode.
mkdir $env:USERPROFILE\nginxcode $env:USERPROFILE\nginx
2. Once in VSCode, click the New File icon and create a new file named index.html.
3. Copy the code below, paste it into index.html, and save the file.
<h1>Hello World from NGINX!!</h1>
4. Next, create a new file named Dockerfile.
5. Paste the following content into the Dockerfile and save it. This file uses the official NGINX image as a base and copies the index.html file from the local file system into the NGINX container.
FROM nginx:alpineCOPY . /usr/share/nginx/html
6. Run the following command to build the image. The –tag flag tags the image with nginx-helloworld:latest. The –namespace flag specifies the Kubernetes namespace in which to build the image. The resulting image will be available in the k8s.io namespace.
nerdctl --namespace k8s.io build --tag nginx-helloworld:latest .
The screenshot below shows a successful image build.
7. List the images in the k8s.io registry.
nerdctl --namespace k8s.io images
You will see nginx-helloworld image in the result.
Deploying the NGINX Container to Kubernetes
1. Open the Rancher Desktop application, click the Kubernetes Settings, and ensure that the containerd container runtime is selected. Kubernetes requires the containerd runtime to run containers.
2. Switch to the VSCode PowerShell terminal and run the below command to deploy your NGINX container to Kubernetes. This command creates a deployment named hello-world and exposes it on port 80.
The –image-pull-policy=Never flag ensures that kubectl does not pull the image from the remote registry. By default, Kubernetes will try to pull images from a remote registry if unavailable locally. In this case, you’re forcing the local image (nginx-helloworld:latest).
kubectl run hello-world --image=nginx-helloworld:latest --image-pull-policy=Never --port=80
3. Next, run the following command to forward the container’s port 80 to the host’s port 8080.
kubectl port-forward pod/hello-world 8080:80
4. Now, open your web browser and access the application by this URL → http://localhost:8080. You will see the following output.
This tutorial taught you how to get started with Docker Rancher Desktop and Kubernetes. You have also learned how to build a simple NGINX image and deploy it to Kubernetes.
At this point, you should have a good understanding of how to use Rancher Desktop and Kubernetes. You can now continue exploring Kubernetes and learn more about its features.
With this newfound knowledge, you can start building more complex applications and deployments. Why not create a Multi-Node Cluster with k3d and deploy a WordPress site on top of it?
If PowerShell is not working correctly, Docker Desktop might get stuck at the “starting” phase. Here are some possible solutions to resolve the issue: Run PowerShell as Administrator: Ensure you're running PowerShell with administrative privileges. Right-click on the PowerShell icon, and choose “Run as Administrator.”How do I start Docker using rancher Desktop? ›
Open the Rancher Desktop application, click the Kubernetes Settings, and ensure that the containerd container runtime is selected. Kubernetes requires the containerd runtime to run containers. 2. Switch to the VSCode PowerShell terminal and run the below command to deploy your NGINX container to Kubernetes.Does Rancher Desktop require Docker? ›
Docker is required to be installed on nodes where the Rancher server will be installed with Helm on an RKE cluster or with Docker. Docker is not required for RKE2 or K3s clusters. There are a couple of options for installing Docker.Does Rancher Desktop replace Docker Desktop? ›
Rancher Desktop is a nice experience! I can really recommend it. That is not only a replacement of Docker Desktop, but also an extension with Kubernetes features. So you can develop really with a Kubernetes cluster (without Kubernetes in Docker) on your own PC and keep your development secure.Why is docker desktop taking too long to start? ›
To solve the problem, you need to uninstall Docker Desktop completely, delete the residue and leftovers and again download the app. Run the setup (Docker Desktop Installer.exe) as administrator for installation to successfully load this application. Here are the instructions: Press Windows and R keys.How long does it take to start docker desktop? ›
Enables integrated user interface to view and monitor Docker containers. Quickly starts Docker within ten seconds.What is the difference between Docker Desktop and rancher Desktop? ›
Docker and Rancher are used to manage container-based applications. While Docker is a containerization platform, Rancher is a container management platform that provides additional features and capabilities.What is the difference between rancher Desktop and K3s? ›
K3s supports AMD64, ARM64, ARMv7, and S390X architectures but only runs natively on Linux. Rancher Desktop is a cross-platform alternative which offers an integrated graphical management dashboard. Rancher Desktop is a heavier option as it uses virtualization to package a K3s cluster.What is the difference between rancher and rancher Desktop? ›
While Rancher and Rancher Desktop share the Rancher name they do different things. Rancher Desktop is not Rancher on the Desktop. Rancher is a powerful solution to manage Kubernetes clusters. Rancher Desktop provides a local Kubernetes and container management platform.Is Docker Desktop paid now? ›
Our Docker Subscription Service Agreement states: Docker Desktop is free for small businesses (fewer than 250 employees AND less than $10 million in annual revenue), personal use, education, and non-commercial open source projects. Otherwise, it requires a paid subscription for professional use.
Rancher Desktop is a desktop-based container development environment for Windows, macOS, and Linux that is currently at version 1.5. 1. It is a Kubernetes-based solution that utilizes a virtual machine to host a minimal K3s cluster. The container runtimes for docker and containerd are also supported.How to use Rancher Desktop without Kubernetes? ›
A: Open Rancher Desktop settings, click the cog to open Preferences, select Kuberentes, uncheck Enable Kubernetes feature is selected under Kubernetes Settings; uncheck this box to disable it. This will allow you to run just containerd or dockerd by without allocating resources for Kubernetes.Why my Docker desktop is not starting? ›
Hyper-V is not enabled or not installed
Docker Desktop for Windows requires Hyper-V to run. If Hyper-V is not installed or not enabled on your system, you will encounter a “Docker failed to start” error. To enable Hyper-V, follow the below steps: Open the Control Panel on your Windows system.
Make sure there's definitely no VM in Hyper-V. If there is, remove it. Do a “Repair” on “Docker” from “Programs and Features”, this usually recreates the VM if it doesn't exist.Why is Docker Desktop not running? ›
One of the common causes of the Docker Desktop Stopped error on Windows 10 is that your system does not have the required features to run Docker Desktop. These features are virtualization and WSL2. In this step, I will show you how to enable virtualization in BIOS and install WSL2 Linux kernel update on your computer.How do I stop Docker desktop from auto starting container? ›
Click the Docker icon in the menu bar. Select Preferences... (or press Cmd-comma). Deselect 'Start Docker when you log in' on the General tab.