So you want to start using Docker and as a mac user you head over to Install Docker Desktop on Mac .
Setup seems super simple until you see this
Docker Desktop is free for small businesses……..but it requires a paid subscription for professional use.
Now what do you do ? How to leverage the power of Docker on your macOS without paying a hefty subscription fees.
Enter colima
Using colima is simple
$ brew install colima
$ brew install docker
That’s it. Now you can go on to use docker without any issues.
But let’s dive deeper .
What is colima? Why we needed Docker Desktop at all?
What are containers?
A container is a sandboxed process on our machine that is isolated from all other processes on the host machine. That isolation leverages kernel namespaces and cgroups, features that have been in Linux for a long time. Docker packages these capabilities so that they are easy to use.
So Docker can only be run on Linux OS ?
Yes, Docker as technology can only be run on Linux OS.
How do i use docker on my Mac then ?
You use Docker Desktop.
It does 2 important things
- creates Linux VM on your host OS (Windows / Mac)
- forwards docker-cli commands from the host OS to created Linux VM
Thus we are able to run and use docker-cli on Windows/Mac even though these OS’s do not support docker images/containers.
But since Docker Desktop is no longer free, we need alternatives.
Lima
Lima is tool that launches Linux virtual machines with automatic file sharing, port forwarding, and containerd. Linux on Mac
Lima uses QEMU which is type-2 hypervisor, which virtualises the host operating system.
Hence we can now run linux virtual machine on top of our mac.
Also it gives use
- Filesystem sharing between mac host system and virtual machine
- Automatic port forwarding
Lima setup a virtual machine with containerd as container runtime on Mac
We can use nerdctl which docker
cli replacement to run our containers.
Colima
Colima : Containers on Linux on Mac.
Colima builds on top of Lima, it configures the Docker CLI and set docker context such that you can use the docker
client on macOS after colima start
with no additional setup.
Was this article useful to you? I’d love to hear your feedback, so don’t hold back. If you are interested in Kafka, Docker, microservices, or event streaming, or just have any questions, follow me on Twitter.
Also published on dev.to
Sources