
As for many developers, Docker is often part of the developer tools used, and for Loftux where we mostly are developing for Alfresco, and there is multiple containers running locally. In this case, a Macbook M1 with an arm processor. Since Docker cannot run natively on macos, you will have to use a virtual machine to run docker, and the tool often used for that is Docker desktop, comes with a nice UI and easy to install. For small organisations this tool is free, but for larger (250+) it requires a subscription. My experience however is that over time when developing for multiple clients and multiple projects, your docker instance inside Docker desktop becomes bloated and problems arise.
The solution has been to switch to Colima, and its support for multiple profiles.
Running with a custom profile per customer/project lets you keep things separated inside that docker virtual machine. No need to worry that your docker system prune will remove something you need for a separate project. And if it gets to messy or things start acting up, just delete that profile and start over. No risk of losing what is needed for your other projects.
To manage this, I’ve created a wrapper script, you can get a copy from github. In the examples it is assumed is is placed in you environment path
To create a new profile, or start an existing profile for customer acme, run this in your development project folder.. devcolima.sh acme
Notice the starting period, it is there so that the export of DOCKER_HOST in the script becomes available to the shell.
If this is the first time running, it will create that new profile with the defaults that is in the script, disk 50 GB, memory 10 GB, 6 CPU. Just change to match what you need and works for your machine. It also installs Portainer as your GUI if you want that to manage your containers.
The first time you run the script for a project, it maps the current folder as the starting folder when mapping the disk into the virtual machine. This should make things faster, as not your entire home directory is mapped into your virtual machine, but also makes each colima profile work in only that project folder. So for the first initalization, make sure to run the script in your project folder.
When you run . devcolima.sh acme again and the acme profile is running, it asks you if you want to stop it first, so that it does a restart. Or if you switch the project you are currently working with, just run . devcolima.sh coolclient and it will stop the currenctly running colima profile, and start your coolclient profile.
There is just one optional parameter to the script, if you use u or U as second parameter, . devcolima.sh acme u, it will update the colima virtual machine instance and Portainer.
And when your docker instances is starting to act up, or you are done testing some docker based solutions that you don’t need floating around any more, just do colima delete acme. Days of trying to make Docker desktop working again are gone!

