Skip to content

Commit 325175f

Browse files
Updates
1 parent 3b1ef79 commit 325175f

File tree

1 file changed

+70
-83
lines changed

1 file changed

+70
-83
lines changed
Lines changed: 70 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,41 @@
11
---
22
title: Container CLI for macOS
3-
4-
draft: true
5-
63
author: Rani Chowdary Mandepudi
7-
84
minutes_to_complete: 10
9-
105
official_docs: https://github.com/apple/container
11-
126
additional_search_terms:
13-
- container
14-
- virtualization
15-
7+
- container
8+
- virtualization
169
layout: installtoolsall
1710
multi_install: false
1811
multitool_install_part: false
1912
test_maintenance: false
2013
weight: 1
2114
---
2215

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.
16+
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 Docker Desktop or full Linux VMs.
2417

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

2720
## What should I do before installing the Container CLI?
2821

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.
22+
This guide shows how to install and use the `container` CLI to run Arm Linux containers natively on Apple silicon Macs.
3023

31-
Confirm you are using an Apple silicon Mac by running:
24+
First, confirm you are using an Apple silicon Mac by running:
3225

3326
```bash
3427
uname -m
3528
```
3629

37-
The output on macOS is:
30+
Expected output:
3831

3932
```output
4033
arm64
4134
```
4235

43-
Container CLI only works on Macs with Apple silicon, including M1, M2, M3, and M4.
36+
Container CLI supports only Apple silicon Macs (M1, M2, M3, and M4).
4437

45-
Use the following command to verify macOS version:
38+
Check your macOS version:
4639

4740
```bash
4841
sw_vers -productVersion
@@ -54,162 +47,156 @@ Example output:
5447
15.5
5548
```
5649

57-
Your computer must be running macOS 15.0 or later to use the Container CLI.
50+
You must be running **macOS 15.0 or later** to use the Container CLI.
5851

5952
## How do I install Container CLI?
6053

61-
To install Container CLI on macOS, follow the steps below:
54+
To install Container CLI:
6255

63-
From the [official GitHub Release page](https://github.com/apple/container/releases), download the latest signed `.pkg` installer.
56+
Go to the [GitHub Releases page](https://github.com/apple/container/releases) and download the latest signed `.pkg` installer.
6457

6558
For example:
6659

67-
```bash
68-
wget https://github.com/apple/container/releases/download/0.2.0/container-0.2.0-installer-signed.pkg
69-
```
60+
```bash
61+
wget https://github.com/apple/container/releases/download/0.2.0/container-0.2.0-installer-signed.pkg
62+
```
7063

71-
Install the downloaded package using:
64+
Install the package:
7265

73-
```bash
74-
sudo installer -pkg container-0.2.0-installer-signed.pkg -target /
75-
```
66+
```bash
67+
sudo installer -pkg container-0.2.0-installer-signed.pkg -target /
68+
```
7669

77-
This installs the Container binary at `/usr/local/bin/container`
70+
This installs the Container binary at `/usr/local/bin/container`.
7871

79-
After installation, start the container system service by running the following command:
72+
Start the container system service:
8073

81-
```bash
82-
container system start
83-
```
74+
```bash
75+
container system start
76+
```
8477

8578
{{% notice Note %}}
86-
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.
87-
{{% /notice %}}
79+
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.{{%/notice %}}
8880

8981
The background server process is now running.
9082

9183
Verify the CLI version:
9284

93-
```bash
94-
container --version
95-
```
96-
97-
Example output:
85+
```bash
86+
container --version
87+
```
9888

99-
```output
100-
container CLI version 0.2.0
101-
```
89+
Example output:
10290

103-
This confirms that the Container CLI is successfully installed and ready to use.
91+
```output
92+
container CLI version 0.2.0
93+
```
10494

105-
## How do I build, run, and push a container using the Container CLI?
95+
## Build and run a container
10696

10797
### Create a Dockerfile
10898

109-
You can define a simple image that prints the system architecture.
99+
In a working directory, create a file named `Dockerfile`:
110100

111-
Use an editor to create a file named `Dockerfile` with the following contents:
112-
113-
```bash
101+
```dockerfile
114102
FROM ubuntu:latest
115103
CMD echo -n "Architecture is " && uname -m
116104
```
117105

118-
### Build the container image
106+
This image prints the system architecture when executed.
119107

120-
Build the image from the `Dockerfile`.
108+
### Build the image
121109

122-
This will pull the Ubuntu base image and tag the result as `uname`.
110+
Run the following to build and tag the container image as `uname`:
123111

124112
```bash
125113
container build -t uname .
126114
```
127115

128-
The output will be similar to:
116+
Example output:
129117

130118
```output
131119
Successfully built uname:latest
132120
```
133121

134-
### Run the container
122+
### Run the container
135123

136-
Execute the container to verify it runs successfully and prints the system architecture.
124+
Run the container to verify it prints the system architecture.
137125

138-
```bash
126+
```bash
139127
container run --rm uname
140128
```
141129

142-
The output is:
130+
Expected output:
143131

144132
```output
145133
Architecture is aarch64
146134
```
147135

148-
The `--rm` flag removes the container after it finishes.
136+
The `--rm` flag cleans up the container after it exits.
149137

150-
### Tag and push the image
138+
## Tag and push the image
151139

152140
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.
153141

154-
Use the `tag` command to apply a registry-compatible name to the image:
142+
Tag the image with a registry-compatible name:
155143

156-
```bash
157-
container images tag uname docker.io/<your-username>/uname:latest
158-
```
144+
```bash
145+
container images tag uname docker.io/<your-username>/uname:latest
146+
```
159147

160-
Replace `<your-username>` with your Docker Hub username.
148+
Replace `<your-username>` with your Docker Hub username.
161149

162-
Before pushing the image, log in to Docker Hub:
150+
Log in to Docker Hub:
163151

164-
```bash
165-
container registry login docker.io
166-
```
152+
```bash
153+
container registry login docker.io
154+
```
167155

168156
Enter your Docker Hub username and password.
169157

170158
{{% notice Note %}}
171-
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.
172-
{{% /notice %}}
159+
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.{{% /notice %}}
173160

174161
Next, upload the tagged image to Docker Hub.
175162

176-
```bash
177-
container images push docker.io/<your-username>/uname:latest
178-
```
179-
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.
163+
```bash
164+
container images push docker.io/<your-username>/uname:latest
165+
```
166+
## List images and containers
181167

182-
## How can I list images and containers?
168+
To view images:
183169

184-
You can view locally built or pulled images using:
185-
186-
```bash
170+
```bash
187171
container images ls
188172
```
189173

190-
To see running or previously executed containers:
174+
To view running or stopped containers:
191175

192176
```bash
193177
container ls
194178
```
195179

196180
## How do I uninstall the Container CLI?
197181

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.
182+
The CLI includes an uninstall script. You can choose whether to keep or delete your container data.
199183

200-
Uninstall and keep user data (images, containers):
184+
To uninstall and **keep** user data (images and containers):
201185

202-
```bash
186+
```bash
203187
uninstall-container.sh -k
204188
```
205189

206-
Use this if you plan to reinstall later and want to preserve your local container data.
190+
Use this if you plan to reinstall later and want to keep your local container data.
207191

208192
Uninstall and delete all user data:
209193

210194
```bash
211195
uninstall-container.sh -d
212196
```
213-
This will permanently remove the CLI and all container images, logs, and metadata.
214197

215-
You can now build and run Arm Linux containers on macOS.
198+
This will remove the CLI and all related images, logs, and metadata.
199+
200+
---
201+
202+
You’ve now installed Container CLI and built your first Arm Linux container on macOS.

0 commit comments

Comments
 (0)