Docker Series - Running Docker on macOS

Docker Series - Running Docker on macOS
In: Docker
Table of Contents

Welcome back to the next part of the Docker series. In this post, we are going to look at running Docker on macOS. If you’re using Windows, most of the steps will be the same since both platforms rely on Docker Desktop.

On Linux, Docker runs natively, but on macOS and Windows, Docker Desktop creates a lightweight Linux VM in the background, and all your containers run inside that VM. You don’t need to worry about managing the VM yourself because Docker Desktop takes care of it for you.

Docker Series - Hello Docker
As always, my goal here is to explain what Docker is using plain language and relatable examples, I hope to give you a clear understanding of what Docker is.
Docker Series - Running a Webserver and a Cool App
Imagine a situation where you need to quickly set up a web server for testing. Perhaps you want to verify a NAT policy by initiating traffic from the internet or examine

Why Does macOS Need a Linux VM?

Docker was originally built to leverage Linux-specific features like cgroups and namespaces, which are essential for container isolation and resource management. macOS, being based on BSD, doesn’t have these Linux kernel features. This is why Docker Desktop spins up a small Linux VM using a lightweight hypervisor (on macOS it uses Apple’s HyperKit). Inside this VM, Docker runs as if it’s on a native Linux machine. This allows Docker containers to work seamlessly on macOS, despite the differences in the underlying operating system.

💡
Before we start, it's worth mentioning that Docker Desktop is free for personal use, education, and small businesses, but if you’re working for a larger company (250+ employees or more than $10 million in revenue), you may need a paid license. You can find the licensing details on Docker's website if needed.

Installing Docker Desktop

You can download Docker Desktop by navigating to the Docker website and following the on-screen instructions to install it.

For this post, we’ll install Docker Desktop on macOS and use the same example from the previous post, the memos note-taking app. This way, you’ll see that the exact same Docker command works on macOS just like it does on Windows or Linux. Once Docker Desktop is installed and running, you’ll see the Docker Dashboard.

This is a simple UI where you can see your running containers, images, and volumes. It’s not necessary to use the UI for everything, but it’s nice to have if you want to check things visually.

Installing 'Memos' Application

Now, let’s install memos. Open your terminal and run the same command we used earlier. memos is a simple, self-hosted note-taking app that lets you quickly jot down notes right from your browser. It’s lightweight, supports markdown, and stores your notes locally, making it a great option if you prefer to keep your notes private and under your control.

docker run -d \
  --init \
  --name memos \
  --publish 5230:5230 \
  --volume ~/.memos/:/var/opt/memos \
  neosmemo/memos:stable

That’s all you need. Docker will pull the image if it’s not already there, and start the container. Once running, you can access memos by opening http://localhost:5230 in your browser.

That’s the beauty of Docker. The same command works everywhere, whether it’s Linux, Windows, or macOS. No extra setup or environment-specific adjustments. Just run the container, and it works.

Closing Up

As you can see, with a single command, we have a very cool app up and running. If I decide I don’t like the app or no longer need it, I can simply remove it from the terminal using docker rm or directly from the Docker Desktop GUI.

Docker Series - Dockerfile
A Dockerfile is a text document that contains all the instructions a user could tell Docker to assemble an image. Using a Dockerfile, you can automate the
Written by
Suresh Vina
Tech enthusiast sharing Networking, Cloud & Automation insights. Join me in a welcoming space to learn & grow with simplicity and practicality.
Comments
More from Packetswitch
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Packetswitch.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.