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
```
35
+
{{% notice Note %}}
36
+
Container CLI supports only Apple silicon Macs (M1, M2, M3, and M4).
37
+
{{% /notice %}}
42
38
43
-
Container CLI only works on Macs with Apple silicon, including M1, M2, M3, and M4.
44
-
45
-
Use the following command to verify macOS version:
39
+
Check your macOS version:
46
40
47
41
```bash
48
42
sw_vers -productVersion
@@ -54,37 +48,35 @@ Example output:
54
48
15.5
55
49
```
56
50
57
-
Your computer must be running macOS 15.0 or later to use the Container CLI.
51
+
You must be running macOS 15.0 or later to use the Container CLI.
58
52
59
53
## How do I install Container CLI?
60
54
61
-
To install Container CLI on macOS, follow the steps below:
55
+
To install Container CLI:
62
56
63
-
From the [official GitHub Release page](https://github.com/apple/container/releases), download the latest signed `.pkg` installer.
57
+
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`
71
+
This installs the Container binary at `/usr/local/bin/container`.
78
72
79
-
After installation, start the container system service by running the following command:
73
+
Start the container system service:
80
74
81
75
```bash
82
76
container system start
83
77
```
84
78
85
-
{{% 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
+
You must start the service to use commands like `build`, `run`, or `push`. It may need to be restarted after rebooting.
88
80
89
81
The background server process is now running.
90
82
@@ -97,119 +89,109 @@ container --version
97
89
Example output:
98
90
99
91
```output
100
-
container CLI version 0.2.0
92
+
container CLI version 0.2.0
101
93
```
102
94
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?
106
-
107
-
### Create a Dockerfile
95
+
## Build and run a container
108
96
109
-
You can define a simple image that prints the system architecture.
110
97
111
-
Use an editor to create a file named `Dockerfile` with the following contents:
98
+
In a working directory, create a file named `Dockerfile`:
112
99
113
-
```bash
100
+
```dockerfile
114
101
FROM ubuntu:latest
115
102
CMD echo -n "Architecture is " && uname -m
116
103
```
117
104
118
-
### Build the container image
105
+
This image prints the system architecture when executed.
119
106
120
-
Build the image from the `Dockerfile`.
107
+
### Build the image
121
108
122
-
This will pull the Ubuntu base image and tag the result as `uname`.
109
+
Run the following to build and tag the container image as `uname`:
123
110
124
111
```bash
125
112
container build -t uname .
126
113
```
127
114
128
-
The output will be similar to:
115
+
Example output:
129
116
130
117
```output
131
118
Successfully built uname:latest
132
119
```
133
120
134
-
### Run the container
121
+
### Run the container
135
122
136
-
Execute the container to verify it runs successfully and prints the system architecture.
123
+
Run the container to verify it prints the system architecture.
137
124
138
-
```bash
125
+
```bash
139
126
container run --rm uname
140
127
```
141
128
142
-
The output is:
129
+
Expected output:
143
130
144
131
```output
145
132
Architecture is aarch64
146
133
```
147
134
148
-
The `--rm` flag removes the container after it finishes.
135
+
The `--rm` flag cleans up the container after it exits.
149
136
150
-
###Tag and push the image
137
+
## Tag and push the image
151
138
152
139
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
140
154
-
Use the `tag` command to apply a registry-compatible name to the image:
141
+
Tag the image with a registry-compatible name:
155
142
156
-
```bash
143
+
```bash
157
144
container images tag uname docker.io/<your-username>/uname:latest
158
145
```
159
146
160
147
Replace `<your-username>` with your Docker Hub username.
161
148
162
-
Before pushing the image, log in to Docker Hub:
149
+
Log in to Docker Hub:
163
150
164
-
```bash
151
+
```bash
165
152
container registry login docker.io
166
153
```
167
154
168
155
Enter your Docker Hub username and password.
169
156
170
-
{{% notice Note %}}
171
157
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.
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?
165
+
## List images and containers
183
166
184
-
You can view locally built or pulled images using:
167
+
To view images:
185
168
186
-
```bash
169
+
```bash
187
170
container images ls
188
171
```
189
172
190
-
To see running or previously executed containers:
173
+
To view running or stopped containers:
191
174
192
175
```bash
193
176
container ls
194
177
```
195
178
196
179
## How do I uninstall the Container CLI?
197
180
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.
181
+
The CLI includes an uninstall script. You can choose whether to keep or delete your container data.
199
182
200
-
Uninstall and keep user data (images, containers):
183
+
If you plan to reinstall later and want to keep your local container data. To uninstall and keep user data (images and containers):
201
184
202
-
```bash
185
+
```bash
203
186
uninstall-container.sh -k
204
187
```
205
188
206
-
Use this if you plan to reinstall later and want to preserve your local container data.
207
-
208
-
Uninstall and delete all user data:
189
+
Otherwise, to uninstall and delete all user data:
209
190
210
191
```bash
211
192
uninstall-container.sh -d
212
193
```
213
-
This will permanently remove the CLI and all container images, logs, and metadata.
214
194
215
-
You can now build and run Arm Linux containers on macOS.
195
+
This will remove the CLI and all related images, logs, and metadata.
196
+
197
+
You’ve now installed Container CLI and built your first Arm Linux container on macOS.
0 commit comments