π’ Docker on macOS Without Docker Desktop: The Revenge Edition π΄ββ οΈ β
π Why Do We Even Need Docker Desktop on macOS? π€ β
Ah, macOS! The sleek, shiny paradise of developers... until you realize it doesnβt support Docker natively. Why? Because Docker needs Linux Kernel features (like namespaces, cgroups, and other geeky magic), but macOS runs on Darwin, which is like Linuxβs distant cousin who never went to engineering school. π
Docker Desktop acts as a translator π£οΈ between Docker and macOS by running a hidden Linux VM behind the scenes. It makes everything seamless, but at the cost of high CPU usage, RAM-eating habits, and licensing drama. π°π₯
So, what if you donβt want Docker Desktop? What if you want to live dangerously, like a true terminal warrior? π΄ββ οΈ
Well, grab your command-line sword βοΈ because weβre about to set sail! π’
ποΈ The DIY Docker Setup: macOS Style π β
Hereβs how you can run Docker without Docker Desktop using Colima π§ and Lima (because Lima sounds cooler than βLinux VMβ π).
π¦ Step 1: Install Homebrew (If You Haven't Already) β
Homebrew is the unofficial package manager that makes macOS developers feel like theyβre using Linux. Install it if you havenβt:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
π³ Step 2: Install Docker CLI (If You Haven't Already, Because We Still Need It) β
Weβre removing Docker Desktop, not Docker itself! Iβm just suggesting you install thisβdoesnβt mean you have to. I mean, come on, youβre a pro dev, right? You probably installed it before even reading this. If thatβs the case, feel free to skip this part and flex on the newbies. πͺπ Otherwise, hereβs how you do it::
brew install docker
ποΈ Step 3: Install Colima (Your Tiny Linux VM) β
Colima is like Docker Desktop but without the bloat and drama. Install it using:
brew install colima
π₯ Step 4: Start Colima and Let the Magic Begin β
Now, letβs fire up the Linux VM that will run your containers:
colima start
Boom! π₯ Your macOS is now pretending to be a Linux machine. π
β Step 5: Check If Docker Works β
Run:
docker run hello-world
If Docker greets you with a friendly "Hello from Docker!", congrats! You just ditched Docker Desktop like a pro. π
π How Docker CLI Talks to Colima π£οΈ β
When you run a docker
command, the CLI normally talks to Docker Desktopβs VM. But since we banished Docker Desktop to the shadow realm, the CLI now talks to Colimaβs lightweight VM, which provides all the Linux Kernel goodies Docker needs.
Itβs like replacing a corporate CEO with a chill startup founder who still gets things done. π
π€·ββοΈ But What About Kubernetes? (For the Fancy People) β
If you need Kubernetes (K8s), install it separately:
brew install kubectl
colima start --with-kubernetes
Boom! Now you have K8s running without Docker Desktop! π
π Wrapping Up β
π― Why This is Awesome: β
β No high CPU usage π β No annoying licensing restrictions ππ° β Fully open-source and lightweight π§ β You now have Docker without Docker Desktop! π
π― Things to Keep in Mind: β
β οΈ No GUI β This is all terminal-based. If you miss the Docker Desktop UI, wellβ¦ welcome to the real dev life. π β οΈ Some edge cases might be tricky β But hey, thatβs what Stack Overflow is for. π€·ββοΈ
And thatβs it! Youβve successfully rebelled against Docker Desktop. Now go forth and containerize everything, you rogue developer! π΄ββ οΈπ³
Happy hacking! π