Como la mayoría de ustedes ya saben, el 31 de enero es el último día para usar Docker Desktop sin aplicar el nuevo modelo de licencias que prácticamente genera un costo para cualquier uso empresarial. Por supuesto, todavía es gratuito para usar en proyectos de código abierto y pequeñas empresas, pero es mejor cumplir con los requisitos utilizando la documentación oficial de Docker.
Así que debido a esa situación, comencé un viaje para encontrar una alternativa a Docker Desktop porque usaba mucho docker-desktop. El uso principal que hago es iniciar cosas similares a servidores para uso temporal que no me gusta tener instaladas en mi máquina para mantenerla lo más limpia posible (aunque esto no siempre es cierto, pero es un intento).
Entonces, en esa búsqueda, descubrí que Rancher Desktop fue lanzado no hace mucho tiempo y prometía ser la alternativa más adecuada. El objetivo de este post no es comparar ambas plataformas, pero si deseas tener más información, dejo aquí un post que puede proporcionártela:
Rancher Desktop
Container management to build, push, and pull images and run containers. It uses the same container runtime as Kubernetes. Built images are immediately available to use in your local workloads without any pushing, pulling, or copying.
La idea aquí es hablar más sobre el viaje de esa migración. Así que instalé Rancher Desktop 1.0.0 en mi Mac y la instalación fue muy, muy fácil. La principal diferencia con Docker Desktop es que Rancher Desktop está construido pensando en Kubernetes y para Docker Desktop, eso vino como una idea posterior. Así que, por defecto, tendremos un entorno de Kubernetes ejecutándose en nuestro sistema, y podemos incluso seleccionar la versión de ese clúster como puedes ver en la imagen a continuación:
Pero también en Rancher, notaron la ventana de oportunidad que tienen frente a ellos, y fueron muy agresivos al proporcionar un camino de migración fácil desde Docker Desktop. Y lo primero que notarás es que puedes configurar Docker Desktop para que sea compatible con la API de Docker CLI como puedes ver en la imagen a continuación.
Esto no está habilitado por defecto, pero es muy fácil hacerlo y te permitirá no tener que cambiar todos tus comandos “similares a docker” (docker build, docker ps.. ) por lo que suavizará mucho la transición.
Quizás en el futuro, quieras alejarte de todo lo que se asemeje a docker incluso en el lado del cliente y moverte a un enfoque tipo Containers, pero por ahora, lo que necesitaba es simplificar el proceso.
Así que, después de habilitar eso y reiniciar mi Rancher Desktop, puedo escribir mis comandos como puedes ver en la imagen a continuación:
Así que, lo único que necesito hacer es migrar mis imágenes y contenedores. Porque no soy un usuario puro de docker, a veces no sigo la idea de tener tu contenedor sin estado y usar volúmenes especialmente cuando estás haciendo un uso pequeño por algún tiempo y eso es todo. Así que, eso significa que algunos de mis contenedores también necesitan ser movidos a la nueva plataforma para evitar cualquier pérdida de datos.
Así que, mi viaje de migración tuvo diferentes pasos:
En primer lugar, voy a comprometer los contenedores con estado que necesito mantener en el nuevo sistema usando el comando docker commit con la documentación que puedes encontrar aquí:
Luego, exportaré todas las imágenes que tengo ahora en archivos TAR usando el comando docker save con la documentación que puedes encontrar aquí:
Y finalmente, cargaré todas esas imágenes en el nuevo sistema usando el comando docker load para tenerlas disponibles allí. Nuevamente, puedes encontrar la documentación de ese comando específico aquí
Para automatizar un poco el proceso, incluso que no tengo muchas imágenes cargadas porque trato de limpiar de vez en cuando usando el comando docker system prune:
Prefiero no hacerlo manualmente, así que usaré algunos scripts simples para hacer el trabajo.
Así que, para realizar el trabajo de exportación, necesito ejecutar el siguiente comando:
docker image ls -q | xargs -I {} docker image save {} -o {}.tar
Este script guardará todas mis imágenes en diferentes archivos tar en una carpeta específica. Ahora, solo necesito ejecutar el siguiente comando desde la misma carpeta en la que ejecuté el anterior para tener todas las imágenes de vuelta en el nuevo sistema:
find . -name "*.tar" -exec docker load -i {} ;
La razón por la que no estoy haciendo ambas acciones al mismo tiempo es que necesito tener Docker Desktop ejecutándose para la primera parte y Rancher Desktop para la otra. Así que, aunque puedo automatizar eso también, creo que no vale la pena.
Y eso es todo, ahora puedo eliminar Docker Desktop de mi portátil, y mi vida continuará siendo la misma. Intentaré proporcionar más comentarios sobre cómo se siente, especialmente en cuanto a la utilización de recursos y temas similares en un futuro cercano.
As most of you already know, the 31st of January is the last day to use Docker Desktop without applying the new licensing model that pretty much generates a cost for any company usage. Of course, it is still free to use for open-source and small companies, but it is better to meet the requirements using Docker official documentation.
So because of that situation, I started a journey to find an alternative to Docker Desktop because I used docker-desktop a lot. The primary use I do is to startup server-like things for temporary usage that I don’t like to have installed in my machine to keep it as clean as possible (even though this is not always true, but it is an attempt).
So, on that search, I discovered Rancher Desktop was released not a long time ago and promised to be the most suitable alternative. The goal of this post is not to compare both platforms, but if you like to have more information I leave here a post that can provide it to you:
Rancher Desktop
Container management to build, push, and pull images and run containers. It uses the same container runtime as Kubernetes. Built images are immediately available to use in your local workloads without any pushing, pulling, or copying.
The idea here is to talk more about the journey of that migration. So I installed the Rancher Desktop 1.0.0 on my Mac and the installation was very, very easy. The main difference with Docker Desktop is that Rancher Desktop is built with Kubernetes in mind and for Docker Desktop, that came as an afterthought. So, by default we will have a Kubernetes environment running in our system, and we can even select the version of that cluster as you can see in the picture below:
But also in Rancher, they noticed the opportunity window they have in front of them, and they were very aggressive in providing an easy migration path from Docker Desktop. And the first thing you will notice is that you can configure Docker Desktop to be compliant with the Docker CLI API as you can see in the picture below.
This is not enabled by default, but it is very easy to do it and it will make you not need to change all your “docker-like” commands (docker build, docker ps.. ) so it will smooth a lot of the transition.
Maybe in the future, you want to move away from everything resembling docker even at the client-side and move to a Containers kind of approach, but for now, what I needed is to simplify the process.
So, after enabling that and restarting my Rancher Desktop, I can type my commands as you can see in the picture below:
So, the only thing I need to do is migrate my images and containers. Because I’m not a pure docker usage, I don’t follow sometimes the thing to have your container stateless and using volumes especially when you are doing a small use for some time and that’s it. So, that means that some of my containers also need to be moved to the new platform to avoid any data loss.
So, my migration journey had different steps:
First of all, I will commit the stateful containers that I need to keep on the new system using the command docker commit with the documentation that you can find here:
Then, I will export all the images that I have now in TAR files using the command docker save with the documentation that you can find it here:
And finally, I will load all those images on the new system using docker load command to have it available there. Again, you can find the documentation of that specific command here
To automate a little bit the process even that I don’t have much images loaded because I try to clean up from time to time using the docker system prune command:
I prefer not to do it manually, so I will use some simple scripts to do the job.
So, to perform the export job I need to run the following command:
docker image ls -q | xargs -I {} docker image save {} -o {}.tar
This script will save to have all my images on different tar files into a specific folder. Now, I just need to run the following command from the same folder I had run the previous one to have all the images back into the new system:
find . -name "*.tar" -exec docker load -i {} \;
The reason why I’m not doing both actions at the same time is that I need to have running Docker Desktop for the first part and Rancher Desktop for the other. So even though I can automate that as well, I think it is not worth it.
And that’s it, now I can remove the Docker Desktop from my laptop, and my life will continue to be the same. I will try to provide more feedback on how it feels, especially regarding resource utilization and similar topics in the near future.