Tutorial: Setting Up and Exploring Apple Containerization on macOS

In a previous post, I introduced Apple Containers and compared it with Docker Desktop for macOS. In this tutorial, we will explore the CLI to run containers using native Apple Containerization technology on macOS 15 Sequoia.
Step 1 – Installing the Container CLI
Download the latest version of the command line interface from https://github.com/apple/container/releases and run the package.
Verify the installation with the command container --version
Once the CLI is installed, start the API server with the command container system start
Step 2 – Exploring the Environment
Apple’s Container CLI is compatible with Docker CLI. It supports most of the commands and switches with which you are familiar.
Let’s run a web server to explore this.
1 |
container run --name apache -it --rm -d httpd |
We can now check the running container with the following command:
1 |
container ls |
Notice that there are two fundamental differences between Apple Containers and Docker. We didn’t have to do port mapping by mentioning the container port and host port while running the image. Second, when we listed the containers, we saw that it got a dedicated IP address (192.168.4.2). This indicates that the container is running in a dedicated VM associated with an explicit IP address.
Let’s access the container with the curl
command.
It’s also important to understand that Apple Containers support running the standard OCI images from any public registry. In our case, we pulled the Apache web server from the Docker library.
Apple Container environment includes an embedded DNS service that simplifies access to the containerized applications. For example, we can configure dev.local
as the DNS domain, making it available to all containers.
1 2 |
sudo container system dns create dev.local container system dns default set dev.local |
Now, when we run a web application, we can access it through container-name.dev.local
1 |
container run --name nginx -it --rm -d nginx |
We can now access the Nginx container using its DNS name – nginx.dev.local
Step 3 – Dealing With Images
You can follow the familiar workflow of creating a Dockerfile, pushing it to a registry, pulling it, and running it. Let’s see this in action.
We will start by building an image from a Python base image.
Let’s build the image from the Dockerfile.
1 |
container build --tag python-test --file Dockerfile . |
You can list the image by running the command container images ls
.
Let’s push the image to the Docker image registry. Run the command below to authenticate with your Docker credentials.
1 |
container registry login docker.io |
We are now ready to tag and push the image.
1 2 |
container images tag python-test janakiramm/python-test container push janakiramm/python-test |
Hope you found this tutorial useful. You can continue to explore Apple Containers at https://apple.github.io/container/documentation/.