You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Container CLI is an open-source commandline 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.
24
17
25
18
It supports the full OCI (Open Container Initiative) workflow: building, running, tagging, and pushing container images.
26
19
27
20
## What should I do before installing the Container CLI?
28
21
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.
30
23
31
-
Confirm you are using an Apple silicon Mac by running:
24
+
First, confirm you are using an Apple silicon Mac by running:
32
25
33
26
```bash
34
27
uname -m
35
28
```
36
29
37
-
The output on macOS is:
30
+
Expected output:
38
31
39
32
```output
40
33
arm64
41
34
```
42
35
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).
44
37
45
-
Use the following command to verify macOS version:
38
+
Check your macOS version:
46
39
47
40
```bash
48
41
sw_vers -productVersion
@@ -54,162 +47,156 @@ Example output:
54
47
15.5
55
48
```
56
49
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.
58
51
59
52
## How do I install Container CLI?
60
53
61
-
To install Container CLI on macOS, follow the steps below:
54
+
To install Container CLI:
62
55
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.
This installs the Container binary at `/usr/local/bin/container`
70
+
This installs the Container binary at `/usr/local/bin/container`.
78
71
79
-
After installation, start the container system service by running the following command:
72
+
Start the container system service:
80
73
81
-
```bash
82
-
container system start
83
-
```
74
+
```bash
75
+
container system start
76
+
```
84
77
85
78
{{% 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 %}}
88
80
89
81
The background server process is now running.
90
82
91
83
Verify the CLI version:
92
84
93
-
```bash
94
-
container --version
95
-
```
96
-
97
-
Example output:
85
+
```bash
86
+
container --version
87
+
```
98
88
99
-
```output
100
-
container CLI version 0.2.0
101
-
```
89
+
Example output:
102
90
103
-
This confirms that the Container CLI is successfully installed and ready to use.
91
+
```output
92
+
container CLI version 0.2.0
93
+
```
104
94
105
-
## How do I build, run, and push a container using the Container CLI?
95
+
## Build and runa container
106
96
107
97
### Create a Dockerfile
108
98
109
-
You can define a simple image that prints the system architecture.
99
+
In a working directory, create a file named `Dockerfile`:
110
100
111
-
Use an editor to create a file named `Dockerfile` with the following contents:
112
-
113
-
```bash
101
+
```dockerfile
114
102
FROM ubuntu:latest
115
103
CMD echo -n "Architecture is " && uname -m
116
104
```
117
105
118
-
### Build the container image
106
+
This image prints the system architecture when executed.
119
107
120
-
Build the image from the `Dockerfile`.
108
+
### Build the image
121
109
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`:
123
111
124
112
```bash
125
113
container build -t uname .
126
114
```
127
115
128
-
The output will be similar to:
116
+
Example output:
129
117
130
118
```output
131
119
Successfully built uname:latest
132
120
```
133
121
134
-
### Run the container
122
+
### Run the container
135
123
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.
137
125
138
-
```bash
126
+
```bash
139
127
container run --rm uname
140
128
```
141
129
142
-
The output is:
130
+
Expected output:
143
131
144
132
```output
145
133
Architecture is aarch64
146
134
```
147
135
148
-
The `--rm` flag removes the container after it finishes.
136
+
The `--rm` flag cleans up the container after it exits.
149
137
150
-
###Tag and push the image
138
+
## Tag and push the image
151
139
152
140
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.
153
141
154
-
Use the `tag` command to apply a registry-compatible name to the image:
142
+
Tag the image with a registry-compatible name:
155
143
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
+
```
159
147
160
-
Replace `<your-username>` with your Docker Hub username.
148
+
Replace `<your-username>` with your Docker Hub username.
161
149
162
-
Before pushing the image, log in to Docker Hub:
150
+
Log in to Docker Hub:
163
151
164
-
```bash
165
-
container registry login docker.io
166
-
```
152
+
```bash
153
+
container registry login docker.io
154
+
```
167
155
168
156
Enter your Docker Hub username and password.
169
157
170
158
{{% 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 %}}
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.
You can view locally built or pulled images using:
185
-
186
-
```bash
170
+
```bash
187
171
container images ls
188
172
```
189
173
190
-
To see running or previously executed containers:
174
+
To view running or stopped containers:
191
175
192
176
```bash
193
177
container ls
194
178
```
195
179
196
180
## How do I uninstall the Container CLI?
197
181
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.
199
183
200
-
Uninstall and keep user data (images, containers):
184
+
To uninstall and **keep** user data (images and containers):
201
185
202
-
```bash
186
+
```bash
203
187
uninstall-container.sh -k
204
188
```
205
189
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.
207
191
208
192
Uninstall and delete all user data:
209
193
210
194
```bash
211
195
uninstall-container.sh -d
212
196
```
213
-
This will permanently remove the CLI and all container images, logs, and metadata.
214
197
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