Replace docker with Rancher+Nerdctl 🔥

Updated: 17 hours ago




As most of you know, Docker Desktop and Docker CLI is not free to use from Jan 31st, 2022. Of course, it remains 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. So clearly I cannot use Docker for my day-to-day development. After lot of research, I found a combination which can be used to replace the docker.

Reference: https://www.docker.com/blog/do-the-new-terms-of-docker-desktop-apply-if-you-dont-use-the-docker-desktop-ui/



Rancher Desktop + Nerdctl (containerd)

Reasons:

  • Almost no changes to do to run existing docker containers.

  • Run your own local kubernetes cluster and can specify the version of kubernetes

  • Rich user interface

  • Nerdctl and docker CLI commands are almost similar

Disclaimer: I haven't tested it on Apple Silicon M1 computers, but it worked perfectly on Apple Intel.

Rancher Desktop:

An open-source desktop application for Mac, Windows and Linux. Rancher Desktop runs Kubernetes and container management on your desktop. Rancher Desktop uses k3s (light weight kubernetes distribution) for local kubernetes cluster.


Credit: https://rancherdesktop.io/


Pros:

  • GUI interface

  • You can choose the version of Kubernetes you want to run

  • build, push, pull, and run container images using either containerd or Moby (dockerd)

  • Open source

Rancher Desktop alone is insufficient to totally replace Docker, including the CLI, which is where Nerdctl comes in to support the Docker CLI commands.


Nerdctl:

Nerdctl is a sub project of containerd. (open source container runtime) and it is a Docker-compatible CLI for containerd. Almost all nerdctl commands are similar to docker CLI commands except few like (docker system prune).


Pros:

  • Docker compatible CLI

  • Supports Docker compose (nerdctl compose up/down)

  • Can build, run docker images


Quick Tip: For users who are only familiar with docker commands, you may build an alias and add it to your respective shell (.zhrc, .bashrc, etc.).


alias docker = nerdctl

Demo:


1. Download Rancher Desktop client: https://rancherdesktop.io/


2. Update Kubernetes Settings: I have disabled the kubernetes for the sake of this article and also given 2GB memory and 2 Core CPU to start with and selected containerd as runtime


3. Supporting Utilities: Enable nerdctl


Note: Nerdctl is a default cli for newer versions of Rancher Desktop. Supporting utilities section has been removed from UI

4. That's it, now you can run your docker containers in your local machine.

docker compose up -d

With out alias:

nerdctl compose up -d

Test:

For the sake of testing, I had created a docker compose file to spin up postgres and pgAdmin containers in my local machine.


docker-compose.yml:


credit: https://github.com/khezen/compose-postgres


Running docker compose up -d will spin up all the containers in detached mode.




For more info, you can refer to this awesome video by devops-toolkit:



References:

https://github.com/containerd/nerdctl

https://github.com/khezen/compose-postgres

https://rancherdesktop.io/


81 views0 comments

Recent Posts

See All
DSC_0719_edited.jpg

Vasu Jinagam

Hi Myself Vasu Jinagam from Bengaluru India and I am a senior product Engineer at SIXT.

 

HangoutDude is a No Nonsense Tech and story blog and I mainly talk about Golang, Java, Distributed Microservices, Opensource and Cloud computing

You can reach out to me @ jinagamvasubabu@gmail.com