Skip to content

Commit be9f8cb

Browse files
Merge pull request #2127 from jasonrandrews/review
Review Container CLI for macOS
2 parents 31df7ea + a3c6811 commit be9f8cb

File tree

1 file changed

+75
-44
lines changed

1 file changed

+75
-44
lines changed

content/install-guides/container.md

Lines changed: 75 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
---
2-
additional_search_terms:
3-
- apple container CLI
4-
- macOS virtualization
5-
- docker alternative
6-
- arm64 mac containers
2+
title: Container CLI for macOS
3+
4+
draft: true
5+
76
author: Rani Chowdary Mandepudi
8-
layout: installtoolsall
7+
98
minutes_to_complete: 10
9+
10+
official_docs: https://github.com/apple/container
11+
12+
additional_search_terms:
13+
- container
14+
- virtualization
15+
16+
layout: installtoolsall
1017
multi_install: false
1118
multitool_install_part: false
12-
official_docs: https://github.com/apple/container
13-
test_maintenance: true
14-
test_images:
15-
- macos-arm64
16-
test_link: null
17-
title: Apple Container CLI (macOS)
18-
tool_install: true
19+
test_maintenance: false
1920
weight: 1
2021
---
2122

22-
The Apple Container CLI is an open-source tool by Apple for running and building containers directly on macOS using lightweight virtual machines, without needing Docker Desktop or Linux VMs.
23+
Container CLI is an open-source command line tool from Apple for building and running Arm Linux containers directly on macOS using lightweight virtual machines, without the need for Docker Desktop or Linux VMs.
2324

2425
It supports the full OCI (Open Container Initiative) workflow: building, running, tagging, and pushing container images.
2526

26-
## What should I do before installing the Apple Container CLI?
27+
## What should I do before installing the Container CLI?
28+
29+
This article provides a step-by-step guide to install and use the `container` command-line tool for building and running Arm Linux containers natively on macOS systems with Apple silicon.
2730

28-
This article provides a step-by-step guide to install and use Apple's `container` command-line tool for building and running containers natively on macOS Arm systems.
31+
Confirm you are using an Apple silicon Mac by running:
2932

30-
Confirm you are using an Apple Silicon (Arm-based) Mac by running:
3133
```bash
3234
uname -m
3335
```
3436

35-
The output on macOS should be:
37+
The output on macOS is:
38+
3639
```output
3740
arm64
3841
```
3942

40-
The Apple Container CLI only works on Arm-based Macs (M1, M2, M3).
43+
Container CLI only works on Macs with Apple silicon, including M1, M2, M3, and M4.
4144

4245
Use the following command to verify macOS version:
46+
4347
```bash
4448
sw_vers -productVersion
4549
```
@@ -49,15 +53,30 @@ Example output:
4953
```output
5054
15.5
5155
```
52-
It must be running macOS 15.0 or later to use the Apple Container CLI.
5356

54-
## How do I install the Apple Container CLI ?
57+
Your computer must be running macOS 15.0 or later to use the Container CLI.
5558

56-
To install the Apple Container CLI on macOS, follow the steps below:
59+
## How do I install Container CLI?
5760

58-
From the [official GitHub Release page](https://github.com/apple/container/releases), download the latest `.pkg` installer. This installs the container binary at `/usr/local/bin/container`.
61+
To install Container CLI on macOS, follow the steps below:
62+
63+
From the [official GitHub Release page](https://github.com/apple/container/releases), download the latest signed `.pkg` installer.
64+
65+
For example:
66+
67+
```bash
68+
wget https://github.com/apple/container/releases/download/0.2.0/container-0.2.0-installer-signed.pkg
69+
```
5970

60-
After installation, start the container system service by running the following command in the terminal:
71+
Install the downloaded package using:
72+
73+
```bash
74+
sudo installer -pkg container-0.2.0-installer-signed.pkg -target /
75+
```
76+
77+
This installs the Container binary at `/usr/local/bin/container`
78+
79+
After installation, start the container system service by running the following command:
6180

6281
```bash
6382
container system start
@@ -67,7 +86,7 @@ container system start
6786
The system service must be running to use container operations such as build, run, or push. It may also need to be started again after a reboot, depending on system settings.
6887
{{% /notice %}}
6988

70-
This sets up the virtualization support needed for containers to run.
89+
The background server process is now running.
7190

7291
Verify the CLI version:
7392

@@ -80,30 +99,34 @@ Example output:
8099
```output
81100
container CLI version 0.2.0
82101
```
83-
This confirms that the Apple Container CLI is successfully installed and ready to use.
84102

85-
## How do I build, run, and push a container using the Apple Container CLI ?
103+
This confirms that the Container CLI is successfully installed and ready to use.
104+
105+
## How do I build, run, and push a container using the Container CLI?
86106

87107
### Create a Dockerfile
88-
Let's define a simple image that prints the system architecture when run.
89108

90-
Create a file named `Dockerfile` with the following content:
109+
You can define a simple image that prints the system architecture.
91110

92-
```bash
111+
Use an editor to create a file named `Dockerfile` with the following contents:
93112

113+
```bash
94114
FROM ubuntu:latest
95115
CMD echo -n "Architecture is " && uname -m
96-
97116
```
98117

99118
### Build the container image
100-
Build the image from the `Dockerfile`. This will pull the Ubuntu base image and tag the result as `uname`
119+
120+
Build the image from the `Dockerfile`.
121+
122+
This will pull the Ubuntu base image and tag the result as `uname`.
101123

102124
```bash
103125
container build -t uname .
104126
```
105127

106128
The output will be similar to:
129+
107130
```output
108131
Successfully built uname:latest
109132
```
@@ -116,13 +139,15 @@ Execute the container to verify it runs successfully and prints the system archi
116139
container run --rm uname
117140
```
118141

119-
Expected output:
142+
The output is:
143+
120144
```output
121145
Architecture is aarch64
122146
```
123-
The `--rm` flag removes the container after it finishes running.
124147

125-
### Tag and Push the image
148+
The `--rm` flag removes the container after it finishes.
149+
150+
### Tag and push the image
126151

127152
Once the image is built and tested locally, it can be pushed to a container registry such as Docker Hub. This allows the image to be reused across machines or shared with others.
128153

@@ -131,27 +156,30 @@ Use the `tag` command to apply a registry-compatible name to the image:
131156
```bash
132157
container images tag uname docker.io/<your-username>/uname:latest
133158
```
159+
134160
Replace `<your-username>` with your Docker Hub username.
135161

136-
Before pushing the image, log into Docker Hub:
162+
Before pushing the image, log in to Docker Hub:
137163

138164
```bash
139165
container registry login docker.io
140166
```
141-
This will prompt for Docker Hub username and password.
167+
168+
Enter your Docker Hub username and password.
142169

143170
{{% notice Note %}}
144171
The same command works with other registries such as GitHub Container Registry (ghcr.io) or any OCI-compliant registry. Replace `docker.io` with the appropriate registry hostname.
145172
{{% /notice %}}
146173

147-
Now upload the tagged image to Docker Hub:
174+
Next, upload the tagged image to Docker Hub.
148175

149176
```bash
150177
container images push docker.io/<your-username>/uname:latest
151178
```
152-
Once the push completes successfully, the image will be available in the Docker Hub repository. It can be pulled and run on other systems that support the Arm64 architecture.
153179

154-
## How to list images and containers
180+
Once the push completes successfully, the image will be available in the Docker Hub repository. It can be pulled and run on other systems that support the Arm architecture.
181+
182+
## How can I list images and containers?
155183

156184
You can view locally built or pulled images using:
157185

@@ -165,20 +193,23 @@ To see running or previously executed containers:
165193
container ls
166194
```
167195

168-
## How do I uninstall the Apple Container CLI?
196+
## How do I uninstall the Container CLI?
169197

170-
The Apple Container CLI includes an uninstall script that allows you to remove the tool from your system. You can choose to remove the CLI with or without user data.
198+
The Container CLI includes an uninstall script that allows you to remove the tool from your system. You can choose to remove the CLI with or without user data.
171199

172-
### Uninstall and keep user data (images, containers):
200+
Uninstall and keep user data (images, containers):
173201

174202
```bash
175203
uninstall-container.sh -k
176204
```
205+
177206
Use this if you plan to reinstall later and want to preserve your local container data.
178207

179-
### Uninstall and delete all user data:
208+
Uninstall and delete all user data:
180209

181210
```bash
182211
uninstall-container.sh -d
183212
```
184213
This will permanently remove the CLI and all container images, logs, and metadata.
214+
215+
You can now build and run Arm Linux containers on macOS.

0 commit comments

Comments
 (0)